Let the fraction be F = P/Q. Then
the fraction equals 1/2 if 1 is subtracted from both numerator and denominator: i.e. (P-1)/(Q-1) = 1/2
Multiplying out gives, 2P - 2 = Q - 1
2P = Q + 1
it is equal to 2/3 if 1 is added to both the numerator and denominator: i.e. (P+1)/(Q+1) = 2/3
Multiplying out gives, 3P + 3 = 2Q + 2
3P = 2Q - 1
4P = 2Q + 2 --- 1st equation multiplied by 2
3P = 2Q - 1 -- the 2nd equation again
P = 3 -- 1st eqn above minus the 2nd eqn above
Substituting for P = 3 in 2P = Q + 1 give Q = 5
Answer: P = 3, Q = 5