Given data
The initial distance covered is d1 = 5 miles
The initial speed is s1 = 30 mi/hr
The final distance is d2 = 3 miles
The final speed is s2 = 50 mi/hr
The expression for the initial time taken to travel is given as:
The expression for the final time taken is given as:
The expression for the average speed for the whole trip is given as:
Substitute the value in the above equation.
Thus, the average speed for the whole trip is 35.3 mi/hr.