Let X and Y be their ages today
X*Y = 36.... Eq 1
after three year , the ages are X+3 and Y+3
and
X+3 = 2(Y+3)-2
X+3 = 2Y +6 -2
X+3 = 2Y +4
or
X - 2Y =1.... Eq 2
Now solve 1 and 2 using substitution method
Gives X = 9 years an Y = 4 years