Let the number of red pens = R and blue pens = B
So
B / R = 3 /4 ⇒ B = (3/4) R
In the second scenario we have that
(R - 1) / ( B - 2) = 3 /2
Sub in for B
(R -1) / ( (3/4)R -2 ) = 3/2 cross-multiply
2 ( R -1) = 3 ( (3/4) R - 2) simplify
2R -2 = (9/4)R - 6 rearrange as
6 - 2 = (9/4)R - 2R
4 = (9/4)R - (8/4)R
4 = (1/4) R multiply through by 4
16 = R
Check
Initially : R / B = 16 / (3/4)R = 16 /12 = 4 /3
Then : (16 - 1) / ( 12 -2) = 15 /10 = 3 / 2