.
In 1987, Joy was 3 times as old as Ali and 8 ears older than Ali.
From it, you may conclude that in 1987 Ali was 4 years old, while Joy was 12 years old.
Hence, in 1999, Ali was 4 + (1999-1987) = 4 + 12 = 16 years old, ANSWER
while Joy was 12 + (1999-1987) = 12 + 12 = 24 years old. ANSWER
Solved.
It is mental solution, without using equation.
If you want an algebraic solution, here it is.
Let A be the age of Ali in 1987.
Then Joy's age at that time was 3A, according to the condition.
Also, we know that
3A - A = 8. ("Ali was born 8 year after Joy")
So,
2A = 8 ====> A = 8/2 = 4 years (Ali's age in 1987).
From this point, you can complete the solution by the same way as I did it before.
You will get the same answer : Ali was 16 years old in 1999; Joy was 24 years old at that time.
Solved (two times with two methods).