Sub topic 2
Relative speed, trains, boats, and meeting points
This chapter assumes you can work with fractions and ratios, solve linear equations in one variable, and convert units. Each section builds on relative speed, the speed of one moving object as seen from another.
Relative speed: same and opposite directions
When two objects move along the same line, their relative speed is:
- Same direction: the difference of the speeds, because the faster one gains on the slower one.
- Opposite directions: the sum of the speeds, because they close the gap from both ends.
def relative_speed(s1, s2, same_direction):
return abs(s1 - s2) if same_direction else s1 + s2
print(relative_speed(60, 40, True)) # 20
print(relative_speed(60, 40, False)) # 100Trains: poles, platforms and other trains
A train passing a pole covers its own length. A train passing a platform covers its length plus the platform's length. Convert km/h to m/s by multiplying by 5/18 before dividing distance by speed.
train_length = 150 # metres
platform_length = 150 # metres
speed_ms = 54 * 5 / 18 # 15.0 m/s
print((train_length + platform_length) / speed_ms) # 20.0 secondsFor two trains, use the sum of their lengths as the distance and the relative speed as the speed.
Boats and streams: upstream and downstream
Downstream speed is the boat's still-water speed plus the current. Upstream speed is the still-water speed minus the current.
downstream = 15 # km/h
upstream = 9 # km/h
still_water = (downstream + upstream) / 2 # 12.0
current = (downstream - upstream) / 2 # 3.0
print(still_water, current)Meeting points and the post-meeting time ratio
Two travellers start at points A and B, a distance D apart, with speeds a and b. They meet after t = D/(a+b). If the travellers continue to the far end, the time each takes after meeting, x for A and y for B, satisfies x:y = b²:a².
flowchart TD
A[Start: know both speeds] --> B{Same or opposite direction?}
B -->|Same| C[Relative speed = difference]
B -->|Opposite| D[Relative speed = sum]
C --> E[Time = distance / relative speed]
D --> Ecaption: Choosing the relative speed before finding the time. alt: A flowchart. It starts from knowing both speeds, then asks whether the objects move in the same or opposite directions. Same direction leads to relative speed equal to the difference. Opposite direction leads to relative speed equal to the sum. Both lead to time equal to distance divided by relative speed.
Exercise
A boat moves at 12 km/h in still water in a current of 4 km/h. How long does it take to travel 32 km downstream?
Show answer
Downstream speed is 12 + 4 = 16 km/h, so the time is 32 / 16 = 2 hours.