Answer: 5 gallons of gas were used for city driving.
Step-by-step explanation:
Let x represent the number of gallons of gas that the car used on the highway.
Let y represent the number of gallons of gas that the car used in the city.
The car's gas tank can hold 21 gallons. This means that
x + y = 21
A car can travel 25 miles per gallon on the high way and 20 miles in the city. If the car traveled 500 miles on a full tank of gas, it means that
25x + 20y = 500 - - - - - - - - - -1
Substituting x = 21 - y into equation 1, it becomes
25(21 - y) + 20y = 500
525 - 25y + 20y = 500
- 25y + 20y = 500 - 525
- 5y = - 25
y = - 25/ - 5
y = 5
x = 21 - y = 21 - 5
x = 16