If 5 were added to the sum, it would be 4 times Maggies age.
Maggie is (31+5)/4 = 9 years old.
_____
Let m represent Maggie's age. Then her brother's age is 3m-5, and the sum of their ages is ...
31 = m + (3m -5)
36 = 4m . . . . . . . simplify and add 5
9 = m . . . . . . . . . divide by 4