Let A = Alison's age, let F = Flynn's age. We will use these to set up a system of equations.
A + F = 40
A + 4 = F
We can rewrite that second equation by subtracting F from both sides and subtracting 4 from both sides. This gives you a new system of equations:
A + F = 40
A - F = - 4
Notice the Fs are going to cancel leaving us to solve for A when we combine like terms:
2A = 36
Divide both sides by 2 to isolate variable A.
A = 18
Now we plug this into either equation to solve for F. I choose the second equation.
18 + 4 = F
22 = F
Alison is 18 years old and Flynn is 22 years old.