Let the ages of A and B be x and y years respectively. Then,x−y=±2 [Given]
D's age =2x years and, C's age =y2 years.
Clearly, D is older than C
2x−y2=40⇒4x−y=80
Thus, we have the following two systems of linear equations
x−y=2 .(i)
and, 4x−y=80 (ii)
or
x−y=−2 (iii)
and, 4x−y=80 ..(iv)
Substracting equation (i) from equation (ii), we get
3x=78⇒x=26Putting x=26 in equation (i), we get y=24
or
Substracting equation (iv) from equation (iii), we get
−3x=−82⇒x=823=2713
Putting x=823 in equation (iii), we get
y=823+2=883=2913
Hence, A's age =26 years and B's age =24 years
or
A's age =2713 years and B's age =2913 years.