Let the answer be "x years ago".
Noah's age x years ago = 40-x
Mary's age x years ago = 13-x
The equation comes from:
40-x = 4(13-x)
40-x = 52-4x
3x = 12
x = 4
Answers: 4 years ago Noah was 36. 4 years age Mary was 9.
That checks because 36 is 4 times 9.
Edwin