Because the question asks for total distance pedaled, we can set up the following equations:
![x + y = 4](https://img.qammunity.org/2019/formulas/mathematics/middle-school/rya4jve74aja67sfo1o15vo50kksti8q19.png)
![4x + 6y = 18](https://img.qammunity.org/2019/formulas/mathematics/middle-school/fwkmjrg313xgfdbog1kmk31d802xla99ap.png)
x represents the amount of hours James spent pedaling uphill.
y represents the amount of hours James spent pedaling downhill.
4 represents the miles per hour James goes while pedaling uphill.
6 represents the miles per house James goes while pedaling downhill.