A boat goes downstream at 15 km/h and upstream at 9 km/h. What are the speed of the boat in still water and the speed of the stream?
Boat 12 km/h and stream 3 km/h. Downstream = b + s and upstream = b - s, so b = (15 + 9)/2 = 12 and s = (15 - 9)/2 = 3.
Explain it simply
A river is like a moving walkway at an airport. Walking with it, your speeds add; walking against it, the walkway's speed is taken away. So downstream speed is boat plus stream, and upstream speed is boat minus stream. Half their sum is the boat; half their difference is the stream.
Example
Question: Downstream 15 km/h, upstream 9 km/h. Find boat and stream speeds.
- b + s = 15 and b - s = 9.
- Adding: 2b = 24, so b = 12 km/h.
- Subtracting: 2s = 6, so s = 3 km/h.
Follow-up: how long to go 36 km downstream and come back? 36/15 + 36/9 = 2.4 + 4 = 6.4 hours = 6 h 24 min.
const down = 15, up = 9;
console.log([(down + up) / 2, (down - up) / 2]); // Output: [12,3]
console.log(36 / down + 36 / up); // Output: 6.4What to say in the interview
"Downstream is boat plus stream and upstream is boat minus stream. Half the sum gives the boat, 12, and half the difference gives the stream, 3."
Common mistakes
- Swapping boat and stream speeds.
- Averaging speeds to get the round-trip time instead of computing each leg.