Let the present age of A and B be x and y years respectively
From 1st condition
(x - 1) / (y -1) = 3/4
⇒ 4x - 4 = 3y - 3
⇒ 4x - 3y = 1 ... (i)
From 2nd condition,
(x + 1) / (y + 1) = 5/6
⇒ 6x + 6 = 5y + 5
⇒ 6x - 5y = -1 ...(ii)
Multiplying equation (i) by 3 and equation (ii) by 2 and subtract
y = 5
∴ Present age of B = 5 years