We will call A to the number of hours traveled by Annie and B the number of hours travelled by Brian. Then Annie traveled 5 times plus 2 hours than Brian, that is
A = 5 * B + 2. And the total number traveled by both of them was 20, so: A + B = 20
Next step is solve both equations putting value of A in the second equation:
5 * B + 2 + B = 20 that is the same than:
6 * B = 18 and:
B = 3 then:
A = 5 * 3 +2
A = 17
The solution is Annie traveled 17 hours and Brian only traveled 3 hours.