A=30 years B=40 years
let A be x years old and B br y years old.
z year ago age of A was:x-z years
z years ago age of B was:y-z years
l
"B is twice as old as A was when B was as old as A is" this line gives the following relation:
1) as z years ago age of A was (x-z) and B is twice of that age now,so current age
of B is : 2(x-z) years.
2) z years back B's age was x (as in "B was as old as A is").
so after z years ,which is also the current age of B,age of B is:y=x+z years.
so now : 2(x-z)=x+z
x=3z years and y=4z years
"When A is as old as B is now " gives following relation:
y=4z so after z years A's age would be 4z (that way A's age equal to current age of B)and B's age would be 5z.
"both of them together will be 90"
4z+5z=90 years
z=10 years
current age of A is x=3z=30 years
current age of B is y=4z=40 years