So, the cab company charges a flat fee of $4 per cab ride, meaning 4 has no variables in the equation. Now, x is the distance, and the cab company charges $2 per mile driven. Per mile driven is a distance unit, so the x goes with the 2. From that, you can get that the cost is equal to 4 dollars plus 2x (2 times the distance in miles). This is y = 2x+4.