Question 1007628
Call their ages D and M.  Then we have
D = 2M - 5
and if David is 31, then we have
31 = 2M - 5
add five to both sides, then divide by two and get
36 = 2M
M = 18 years old