Why is this calculation of average speed wrong? 
A person drove 120 miles at 40 mph, then drove back the same 120 miles at 60 mph. What was their average speed?

The average of the speeds is 
$$\frac{40\ \text{mph} +60\ \text{mph}}{2} = 50\ \text{mph}$$
so the total trip time should be, by the definition of average speed,
$$\frac{240\ \text{mi}}{50\ \text{mph}} = 4.8 \ \text{hours}.$$
However, this is wrong, because the trip actually took $3 + 2 = 5$ hours.
What did I do wrong, and what is the correct way to calculate the average speed?
 A: $$\mathrm{Average\ Speed = \frac{Total\ Distance}{Total\ time}}$$
So basically,
$t_1 = 120/40 = 3\ hrs$
$t_2 = 120/60 = 2\ hrs$
Total time $= 5\ hrs$
Total distance = $240$ miles
Average speed$ = 240/5 = 48\ mph$
A: The difficulty is that since the trip at 40mph takes longer, you spend more time going 40mph than you do going 60mph, so the average speed is weighted more heavily towards 40 mph.
When calculating average speeds for fixed distances, it is better think of everything in minutes per mile rather than miles per hour.
60 miles per hour is 1 minute per mile, while 40 miles per hour is 1.5 minutes per mile.  Since we travel the same number of miles at each speed, we can now take the mean of these two figures. That's 1.25 minutes per mile on average.  For 240 miles total, 240miles*1.25minutes/mile = 300 minutes = 5 hours.
This method is called finding the "harmonic mean" of the speeds.
A: In order to calculate the average speed you have to weight the time of the different parts of the trip, and not with the distance covered in the same parts!
So the basic formula you hate to use is :
$v_{avg}=S_{tot}/T_{tot}$
If your trip is divided into two parts - $S_1$ covered at speed $V_1$ and $S_2$ covered at speed $V_2$ -
what you can't do is:
$V_{avg}=\frac{V1\times S1+V2\times S2}{S_1+S_2}$
(i.e) actually what you did with yours: $\frac{1}2(40\ mph+60\ mph) = 50\ mph$, since in your example $S_1=S_2$.
Whereas what you can do is:
$V_{avg}=\frac{V1\times T1+V2\times T2}{T1+T2}$
That, given your input, can be written as $\frac{S_1+S_2}{S_1/V_1+S_2/V_2}$, which is indeed equal to $\frac{S_1+S_2}{T_1+T_2}$
A: The reason is because the time taken for the two trips are different, so the average speed is not simply $\frac{v_1 + v_2}{2}$
We should go back to the definition. The average speed is always (total length) ÷ (total time). In your case, the total time can be calculated as
\begin{align}
\text{time}_1 &= \frac{120 \mathrm{miles}}{40 \mathrm{mph}} \\\\
\text{time}_2 &= \frac{120 \mathrm{miles}}{60 \mathrm{mph}}
\end{align}
so the total time is $120\mathrm{miles} \times \left(\frac1{40\mathrm{mph}} + \frac1{60\mathrm{mph}}\right)$. The average speed is therefore:
\begin{align}
\text{average speed} &= \frac{2 \times 120\mathrm{miles}}{120\mathrm{miles} \times \left(\frac1{40\mathrm{mph}} + \frac1{60\mathrm{mph}}\right)} \\\\
&= \frac{2 }{ \left(\frac1{40\mathrm{mph}} + \frac1{60\mathrm{mph}}\right)} \\\\
&= 48 \mathrm{mph}
\end{align}
In general, when the length of the trips are the same, the average speed will be the harmonic mean of the respective speeds.
$$ \text{average speed} = \frac2{\frac1{v_1} + \frac1{v_2}} $$
A: Here, the two velocities are not of the same weight (considering time). It's just like the problem sometimes faced in simple averages ($\frac{x+y}{2}$), when $x$ and $y$ are not equally weighted. In that case we hav to go for the more general expression for average-- which is $\frac{m_1x+m_2y}{m_1+m_2}$.
A: Also it may seem interesting and make such problems less confusing plus I think that is why this question got so much views :
Average velocity and Average speed.
The average velocity ${{\bar V}_x}$ of a particle is defined as the particle’s displacement $\Delta x$ divided by the time interval $\Delta t$ during which that displacement occurred: $${\bar V_x} = {{\Delta x} \over {\Delta t}}$$
Although the distance traveled for any motion is always positive, the average velocity of a particle moving in one dimension can be positive or negative, depending on the sign of the displacement.
In everyday usage, the terms speed and velocity are interchangeable. In physics, however, there is a clear distinction between these two quantities. Consider a marathon runner who runs more than 40 km, yet ends up at his starting point. His average velocity is zero! Nonetheless, we need to be able to quantify how fast he was running. A slightly different ratio accomplishes this for us. The average speed of a particle, a scalar quantity, is defined as the total distance traveled divided by the total time it takes to travel that distance:$$Average\,\,{\rm{ }}speed = {{{\rm{total }}\,\,\,{\rm{distance}}} \over {{\rm{total }}\,\,\,{\rm{time}}}}$$
The SI unit of average speed is the same as the unit of average velocity: meters per second. However, unlike average velocity, average speed has no direction and hence carries no algebraic sign. [1]”
So in the case of this problem we have an average velocity of $\,0\,\,mph$ and an average speed of ${{120miles + 120miles} \over {{{120miles} \over {40mph}} + {{120miles} \over {60mph}}}}\,\,\,mph$ which equals $\,48\,\,mph$ .

[1]     David Halliday, Robert Resnick and Kenneth S. Krane, "Motion in one Dimension," in Physics, John Wiley & Sons, Inc, 2001. 
