**present age**

let age of son be x

let age of father be y

x + y = 45

y = 45 - x

so age of father can also be taken as y = 45 - x

**age after 5 years**

father's age = y + 5 = 45 - x + 5 = 50 -x

son's age = x + 5

( x + 5 ) ( 50 - x ) = 124

45x - x^{2} + 250 = 124

45x - x^{2} - 76 = 0

-x^{2} + 45x - 126 = 0

dividing the equation by -1 to make x^{2} positive

x^{2 }- 45x + 126 = 0

sum = -45, product = 126

x^{2 } - 3x - 42x + 126 = 0

x ( x - 3 ) -42 ( x - 3 ) = 0

( x - 3 ) ( x - 42 ) = 0

x = 3, 42

age of son = x = 3

age of father = y = 45 - x = 45 - 3 = 42