Lets A′s present age be x years
And B′s present age be y years
According to the question
x=y+20
x−y=20.....(1)
Five years ago,
x−5=3(y−5)
x−3y=−10.....(2)
Subtracting (1) from (2),
x−3y=−10.....(2)
x−y=20......(1)
−+−
______________
−2y=−30
y=15
From (1)
x=15+20
x=35
Thus, present ages of A and B are 35 years and 15 years.