You would start with the formula: d=rt distance = rate * time). Since the problem stats a distance and information about the rates, you would rewrite the formula as t = d/r.
For the first person, since they are running a longer distance in the same amount of time, they must be the faster of the two. If the slower person is running at rate r, the faster person is running at rate r + 2.
For the first person, the time they take to run 5 miles is calculated by t = 5 / (r + 2)
For the second person, the time they take to run 4 miles is calculated by t = 4 / r
Since the times are equal, we can set the expressions equal to each other: 5 / (r + 2) = 4 / r.
This makes a proportion, and we can cross multiply to solve it:
5r = 4(r+2)
5r = 4r + 10
r = 10
The first person runs at 10 + 2 or 12 mph and the second person runs at 10 mph