Step 1: The total distance covered is 16 km.
Step 2: The total time taken is the sum of the times for each of the four stretches.
Step 3: The average speed is then calculated using the formula \( \text{average speed} = \frac{\text{total distance}}{\text{total time}} \), yielding approximately 31.2 kmph.
\[
\text{Total distance} = 4 + 4 + 4 + 4 = 16 \, \text{km}
\]
Step 1: Calculate the time taken for each stretch.
- Time for the first stretch:
\[
\text{Time} = \frac{4}{20} = 0.2 \, \text{hours}
\]
- Time for the second stretch:
\[
\text{Time} = \frac{4}{30} = \frac{2}{15} \, \text{hours}
\]
- Time for the third stretch:
\[
\text{Time} = \frac{4}{40} = 0.1 \, \text{hours}
\]
- Time for the fourth stretch:
\[
\text{Time} = \frac{4}{50} = 0.08 \, \text{hours}
\]
Step 2: Calculate the total time.
\[
\text{Total time} = 0.2 + \frac{2}{15} + 0.1 + 0.08 = 0.2 + 0.1333 + 0.1 + 0.08 = 0.5133 \, \text{hours}
\]
Step 3: Calculate the average speed.
\[
\text{Average speed} = \frac{\text{Total distance}}{\text{Total time}} = \frac{16}{0.5133} \approx 31.2 \, \text{kmph}
\]