Let's say that the two cars travel from city A to city B, and we know that AB = 500m.
Let's also say that we consider city A to sit at x = 0, and city B to sit at x = 500. So, speed is positive for the car going from A to B, and is negative for the car going from B to A.
So, the first car follows this rule:
![s_1 = v_1t](https://img.qammunity.org/2019/formulas/mathematics/middle-school/3yxrbxplmsuk1l9rtd090g2aqc3ntosgt3.png)
While the second car follows this rule:
![s_2 = 500 - v_2t](https://img.qammunity.org/2019/formulas/mathematics/middle-school/gjoffm4p234ran2peef0t0kvsft0fib7al.png)
But we know that the difference between their speed is 40, so let's say that
![v2 = v1+40 \implies s_2 = 500 - (v_1+40)t](https://img.qammunity.org/2019/formulas/mathematics/middle-school/pdxcbt6h6vu5y4nxwilc0tyvavedi6m93c.png)
These are the equations that identify the position of the cars after
hours. Since we know that after 5 hours (i.e.
) the cars meet, it means that if we plug that value in both equations, we will have the same results. In formulas,
![5v_1 = 500 - 5(v_1+40)](https://img.qammunity.org/2019/formulas/mathematics/middle-school/so6f4pwozmhdlr3k1myipit7haauksh051.png)
From here, it's easy to rearrange the equation and solve for the first car's speed:
![5v_1 = 500 - 5v_1+200](https://img.qammunity.org/2019/formulas/mathematics/middle-school/3kosluwr461s7no5vnxxa2v8vkxuzewpng.png)
![5v_1 = 700 - 5v_1](https://img.qammunity.org/2019/formulas/mathematics/middle-school/8nf0a5k28riwwunpgwlgjguuw3sqvylimp.png)
![10v_1 = 700](https://img.qammunity.org/2019/formulas/mathematics/middle-school/7gnanudvz78nbw8b5lf1w4iw3lrpj9avdu.png)
![v_1 = 70](https://img.qammunity.org/2019/formulas/mathematics/middle-school/s3b5wcku13lmrlskv3xfyt6r9ozbhkuq6k.png)
And since the speed of the second car was 40 more than the first one, we have
![v_2 = v_1 + 40 = 70 + 40 = 110](https://img.qammunity.org/2019/formulas/mathematics/middle-school/xybedlph6ago6ep59ipddexc7j4p00g686.png)