# What was the average speed for the whole journey?

Last weekend I went to London ...

I calculated my average speed going to London was 30 mph

On the return journey the traffic was terrible and I calculated an average speed of 20mph

What was the average speed for the whole journey ?

Let the distance between your house and London be $x$ miles and denote with $t_1$ the time it took you to travel to London and $t_2$ the time it took you to return from London. Then your average speed $s_1$ (on your way to London) is defined as $$s_1=\frac{\text{ distance to London}}{\text{ time to London }} \implies 30=\frac{x}{ t_1}\tag1$$ and your average speed $s_2$ (on your way back) is $$s_2=\frac{\text{ distance from London}}{\text{ time from London}} \implies 20=\frac{x}{ t_2} \tag2$$ Now the total average speed $s$ is defined as $$s=\frac{\text{total distance}}{\text{total time}} \implies s=\frac{x+x}{t_1+t_2}=\frac{2x}{t_1+t_2}\tag3$$ From equations (1) and (2) you can obtain that $$t_1=\frac{x}{30} \qquad \text{and}\qquad t_2=\frac{x}{20}$$ and therefore substituting in $(3)$ you have that $$s=\frac{2x}{\dfrac{x}{30}+\dfrac{x}{20}}=\frac{\not x}{\not x}\cdot\frac{2}{\dfrac{1}{30}+\dfrac{1}{20}}=\frac{2\cdot20\cdot30}{20+30}=\frac{1200}{50}=24\text{mph}$$ Observe how in the second step the actual distance $x$ simplified out, so that you did not need to know the exact distance to London to solve it.
Hint: Try doing the problem if the distance to London is $60$ miles (this will make the numbers work out nicely). Then see if you can do the problem if the distance is an arbitrary $D$.