Let the man's present age be x years.
Let his son's present age be y years.
According to question, we have:
Two years ago:
Age of the man = Five times the age of the son
⇒ (x − 2) = 5(y − 2)
⇒ x − 2 = 5y − 10
⇒ x − 5y = −8 .....(i)
Two years later:
Age of the man = Three times the age of the son + 8
⇒ (x + 2) = 3(y + 2) + 8
⇒ x + 2 = 3y + 6 + 8
⇒ x − 3y = 12 .....(ii)
Subtracting (i) from (ii), we get:
2y = 20
⇒ y = 10
On substituting y = 10 in (i), we get:
x − 5 × 10 = −8
⇒ x − 50 = −8
⇒ x = (−8 + 50) = 42
Hence, the present age of the man is 42 years and the present age of the son is 10 years.