Senior 5 min · March 06, 2026

Time Speed Distance — Average Speed Trap Delayed ETAs

Planned arrival times showed early — system averaged speeds as (s1+s2)/2 causing 30%+ ETA errors.

N
Naren · Founder
Plain-English first. Then code. Then the interview question.
About
 ● Production Incident 🔎 Debug Guide
Quick Answer
  • Core relationship: Distance = Speed × Time, with three rearrangements
  • Unit conversion is the #1 trap: km/h to m/s multiply by 5/18, minutes to hours divide by 60
  • Relative speed: add speeds when moving toward, subtract when same direction
  • Average speed is total distance / total time, never the arithmetic mean
  • Performance insight: A 1-second error in speed conversion mis-calculates ETA by minutes at highway speeds
  • Production insight: Ride-hailing ETA engine used arithmetic mean — average was off by 30% on mixed-speed routes
Plain-English First

Imagine you're on a road trip. You know your car does 60 miles every hour, and you need to travel 180 miles — how long will it take? That simple question IS a time-speed-distance problem. The three values are always connected: if you know any two, you can always find the third. Think of it like a triangle where covering one corner always reveals the other two.

Time, speed, and distance problems show up everywhere — from Google Maps calculating your arrival time to airline pilots computing fuel burn rates. They're not just textbook puzzles. Any system that involves movement, throughput, or rates is secretly a TSD problem. That's why every major tech company, consulting firm, and bank includes them in their aptitude screening rounds — they test whether you can model a real situation mathematically under time pressure.

The core challenge isn't the formula itself (it's just three words: Distance equals Speed times Time). The real difficulty is knowing which form of the formula to use, how to handle unit mismatches, and how to set up problems that involve multiple moving objects or direction changes without losing track of what's relative to what.

By the end of this article you'll be able to instantly classify any TSD problem into one of five patterns, apply the right formula variant without second-guessing yourself, avoid the three unit-conversion traps that cost candidates marks, and confidently walk an interviewer through your reasoning on the trickiest relative motion scenarios.

What is Time Speed Distance Problems?

Time Speed Distance Problems is a core concept in Interview. Rather than starting with a dry definition, let's see it in action and understand why it exists.

TSD problems model any moving object: a car, a train, a data packet, or a rocket. The three variables — distance, speed, time — are locked in a tight relationship. Given any two, the third is determined. The real challenge isn't the formula; it's identifying the hidden variable and converting all units to a common system before plugging numbers. In interviews, the question rarely hands you the exact values you need. You must extract knowns and unknowns from the narrative.

ForgeExample.javaINTERVIEW
1
2
3
4
5
6
7
8
// TheCodeForgeTime Speed Distance Problems example
// Always use meaningful names, not x or n
public class ForgeExample {
    public static void main(String[] args) {
        String topic = "Time Speed Distance Problems";
        System.out.println("Learning: " + topic + " 🔥");
    }
}
Output
Learning: Time Speed Distance Problems 🔥
Forge Tip:
Type this code yourself rather than copy-pasting. The muscle memory of writing it will help it stick.
Production Insight
In production GPS, sensor data often mislabels speed as distance. A single type inversion causes navigation errors instantly.
Always verify what each input variable actually represents before applying D=ST.
Rule: Validate sensor semantics — not just units.
Key Takeaway
Before solving, ask: which variable am I solving for? Pick the correct rearrangement.
Write the three forms on a sticky note until they're automatic.

The Core Formula: D = S × T and Its Three Forms

The relationship is simple: Distance = Speed × Time. From that you can derive Speed = Distance / Time and Time = Distance / Speed. The trick is picking the right form without second-guessing. Always ask: which variable am I solving for?

Example: A car travels 240 km at 60 km/h. Time = 240 / 60 = 4 hours. If instead you know time and distance, apply the appropriate rearrangement.

In interviews, problems rarely hand you the exact formula you need. They'll give you two quantities and leave the third hidden. Your job is to identify which form to use.

Production Insight
A pilot used knots for speed but statute miles for distance — the unit mismatch caused an unscheduled landing.
Always validate units with dimensional analysis before any calculation.
Rule: Dimensional consistency is not optional — ever.
Key Takeaway
Before solving, ask: which variable am I solving for? Pick the correct rearrangement.
Write the three forms on a sticky note until they're automatic.

Unit Conversion: The Hidden Trap

You'd be surprised how many candidates lose marks because they use km/h with time in minutes. The rule: convert everything to the same unit system before plugging into the formula.

Key conversions
  • km/h to m/s: multiply by 5/18 (or 1000/3600)
  • m/s to km/h: multiply by 18/5
  • minutes to hours: divide by 60
  • hours to minutes: multiply by 60
  • km to meters: multiply by 1000

Example: A train moves at 72 km/h. Express speed in m/s: 72 × (5/18) = 20 m/s.

Common mistake: use 5/18 but apply it the wrong way — multiplying when you should divide. Remember: m/s is a smaller number than km/h, so you multiply by 5/18 to go down.

Production Insight
A pilot used knots for speed but statute miles for distance — the unit mismatch caused an unscheduled landing.
Always validate units with dimensional analysis before any calculation.
Rule: Dimensional consistency is not optional — ever.
Key Takeaway
Always convert units before plugging into the formula.
Use 5/18 for km/h ↔ m/s. Double-check by asking: should the number go up or down?

Relative Speed: When Two Objects Move

When two objects move along the same line, the distance between them changes at their relative speed: - Moving toward each other: relative speed = speed1 + speed2 - Moving in the same direction: relative speed = |speed1 - speed2|

Classic problem: Two trains of lengths 150 m and 200 m move toward each other at 60 km/h and 40 km/h. How long to fully pass each other?

Step 1: Convert speeds to m/s. 60 km/h = 60 × 5/18 = 16.67 m/s. 40 km/h = 11.11 m/s. Step 2: Relative speed = 16.67 + 11.11 = 27.78 m/s. Step 3: Total distance to cover = 150 + 200 = 350 m. Step 4: Time = 350 / 27.78 ≈ 12.6 seconds.

Many forget to add the lengths. Always include both lengths when objects pass each other.

Production Insight
Autonomous vehicles compute Time to Collision as distance / relative speed.
A car ahead brakes: if the system adds speeds instead of subtracting, it can miss the real danger.
Rule: Direction dictates operation — opposite add, same subtract.
Key Takeaway
Distance between moving objects changes at relative speed.
Add speeds when moving toward, subtract when same direction.

Average Speed: Don't Average Speeds

The most common trap in TSD: taking the arithmetic mean of two speeds to get average speed. That is almost always wrong.

Correct: Average speed = Total distance / Total time.

Example: A car goes 60 km/h for 2 hours, then 40 km/h for 3 hours. Wrong average: (60 + 40)/2 = 50 km/h. Correct: Total distance = (60×2) + (40×3) = 120 + 120 = 240 km. Total time = 2 + 3 = 5 hours. Average speed = 240/5 = 48 km/h.

The harmonic mean (2ab/(a+b)) gives the correct answer only when distances are equal. In this case distances are not equal (120 vs 120? Actually they are equal in this example, 120 each, so harmonic mean would work but that's a special case. Better to stick to total distance / total time.

Production Insight
Logistics routing used arithmetic mean: 20 km/h + 80 km/h divided by 2 = 50 km/h.
Correct average (harmonic mean for equal distances) was 32 km/h — ETAs off by 56%.
Rule: Total distance / total time is the only safe average.
Key Takeaway
Average speed = total distance / total time.
Never use arithmetic mean of speeds unless time intervals are equal.

Boats, Streams, Trains, and Circular Tracks

Real-world TSD extensions test your ability to handle multiple frames of reference.

Boats and Streams: - Downstream speed = boat speed + stream speed - Upstream speed = boat speed - stream speed

Trains passing objects: - Passing a stationary object: distance = train length - Passing a moving object: distance = train length + object length (if moving opposite) or difference (if same direction)

Circular tracks: - Time for two runners to meet when running in same direction = track length / (relative speed) - When running opposite directions = track length / (sum of speeds)

These variations are the bread and butter of interview aptitude rounds. There's nothing new in them — it's still D = S × T with adjusted 'distance' and 'speed' definitions.

Production Insight
Race car telemetry computes lap times using relative speed to the car ahead.
Miscounting direction (same vs opposite) changes pit strategy and loses positions.
Rule: Always identify reference frame — ground or relative to another object.
Key Takeaway
Circular track: time to meet = track length / relative speed.
Train vs object: total distance = sum of lengths when passing each other.

Interview Strategy: How to Attack Any TSD Problem in Under 30 Seconds

In aptitude rounds, time pressure is the real test. Here's a repeatable framework:

  1. Identify the scenario: single object, two objects (relative speed), average speed, or special case (boats, trains, circular).
  2. Write down known variables and their units. Convert all to consistent units immediately.
  3. Select the correct formula variant. For relative speed, determine direction.
  4. Solve step by step — interviewers want clear reasoning, not fast mental math.
  5. Double-check: does the answer make sense? (e.g., time shouldn't be negative, speed should be less than absurd.)

Practice this sequence until it's automatic. Most candidates lose marks not because they don't know the formulas but because they rush and skip unit conversion or misidentify the scenario.

Production Insight
In real-time ETA engines, the same framework applies: identify input types, convert units, pick the right formula. A financial analytics platform once misclassified a relative speed problem as a single object — their billing estimates were off by 40%.
Always classify the problem type before touching the formula.
Rule: Classification before calculation.
Key Takeaway
Classify the scenario first — it dictates the formula.
Convert units before any arithmetic.
Show your reasoning step-by-step; interviewers value clarity over speed.
● Production incidentPOST-MORTEMseverity: high

The 10-Minute Delay That Added Two Hours

Symptom
Planned arrival times consistently showed early, then drivers reported delays. Discrepancy grew with more speed variations.
Assumption
Average speed can be computed by adding speeds and dividing by number of segments — i.e., arithmetic mean is correct.
Root cause
The system calculated average speed as (s1 + s2) / 2 instead of total distance / total time. When speeds differed, the error compounded.
Fix
Rewrite the routing engine to compute average speed using weighted time: total distance / sum(time per segment). Validate with a manual test.
Key lesson
  • Never average speeds you didn't weigh by time.
  • Always verify ETA algorithms against real trip logs before deploying.
  • The correct average speed formula is: total distance ÷ total time.
Production debug guideWhen your travel time estimates are consistently wrong, check these symptoms and actions.4 entries
Symptom · 01
Estimated arrival time is off by more than 30%
Fix
Verify that all speeds are in the same unit. Convert km/h to m/s by multiplying by 5/18. Convert minutes to hours by dividing by 60.
Symptom · 02
Average speed seems too high or too low
Fix
Check if you're using arithmetic mean of speeds. Recompute using total distance / total time. For multi-segment trips, sum distances and sum times separately.
Symptom · 03
Two objects passing each other: time computed is too short
Fix
Did you forget to add the lengths of both objects? The total distance to clear is length1 + length2. Relative speed is sum of speeds when moving opposite directions.
Symptom · 04
Train crosses a platform: time off
Fix
Remember the train must cover its own length plus platform length. Distance = train length + platform length. Speed in same units.
TSD Formula Variants Compared
ConceptKey FormulaCommon PitfallProduction Use Case
Single ObjectD = S × TMismatched units (km/h with minutes)GPS ETA for single route
Relative Speed (toward)S_rel = S1 + S2Forgetting to add lengthsCollision avoidance in autonomous vehicles
Relative Speed (same dir)S_rel = |S1 - S2|Subtracting wrong wayOvertaking decision in cruise control
Average SpeedS_avg = D_total / T_totalUsing arithmetic mean of speedsLogistics ETA across mixed-speed segments

Key takeaways

1
TSD models any moving object
know two variables, find the third.
2
Unit conversion first, formula second
always convert km/h to m/s (×5/18).
3
Practice under timed pressure
interview speed matters as much as accuracy.
4
Three formula rearrangements
D=ST, S=D/T, T=D/S. Master which to apply when.
5
Unit conversion is non-negotiable
convert everything to consistent units before calculating.
6
Relative speed is the key to multi-object problems. Add or subtract based on direction.
7
Average speed is always total distance / total time. Never average the speeds.
8
Draw a simple diagram for complex scenarios
it clarifies which distance and speed to use.

Common mistakes to avoid

6 patterns
×

Memorising formulas before understanding the concept

Symptom
You can recite D = S × T but freeze when a problem gives you time and distance and asks for speed.
Fix
Practice converting between the three forms until you can derive any from any two. Use the triangle mnemonic: cover the variable you want, the remaining two show the operation.
×

Skipping practice and only reading theory

Symptom
You understand the explanations but miss half the marks in timed tests.
Fix
Solve at least 10 problems per pattern. Use a timer — interview pressure is real. Track which conversions you get wrong.
×

Using km/h with minutes without converting

Symptom
You apply time in minutes directly into the formula and get a distance that's obviously wrong (e.g., 1800 km instead of 30 km).
Fix
Always convert minutes to hours by dividing by 60 before plugging into D = S × T if speed is in km/h. Better: convert everything to the same unit system at the start.
×

Averaging speeds arithmetically

Symptom
You compute (60 + 40)/2 = 50 km/h as average speed, but the actual average is 48 km/h.
Fix
Use total distance / total time. For two speeds over equal distances, use harmonic mean (2ab/(a+b)). For anything else, compute total distance and total time explicitly.
×

Forgetting to add lengths when trains pass

Symptom
You compute passing time as 200 m / relative speed, but the correct distance is 200 + 150 = 350 m.
Fix
When two objects pass each other, the total distance is the sum of their lengths. Draw a diagram if needed.
×

Misidentifying reference frame — using ground speed when you need relative speed

Symptom
In boat-stream problems, using boat speed in still water as absolute speed instead of accounting for current leads to wrong crossing times.
Fix
Always ask: 'Is this speed relative to ground or relative to another object?' For boats, downstream = boat + stream; upstream = boat - stream.
INTERVIEW PREP · PRACTICE MODE

Interview Questions on This Topic

Q01JUNIOR
A car travels from town A to town B at 60 km/h and returns from B to A a...
Q02SENIOR
Two trains of lengths 150 m and 200 m are moving towards each other at 6...
Q03SENIOR
A boat travels downstream 30 km in 2 hours. The same distance upstream t...
Q04SENIOR
Two runners start from the same point on a circular track of length 400 ...
Q05SENIOR
A train passes a stationary man in 9 seconds and a platform 120 m long i...
Q06SENIOR
A car overtakes a truck traveling at 40 km/h in 10 seconds. The car is 4...
Q01 of 06JUNIOR

A car travels from town A to town B at 60 km/h and returns from B to A at 40 km/h. What is the average speed for the entire trip?

ANSWER
The average speed is NOT (60+40)/2 = 50 km/h. Since the distances are equal, use harmonic mean: 2 60 40 / (60+40) = 4800 / 100 = 48 km/h. Or compute total distance: 2d, total time: d/60 + d/40 = (2d/120 + 3d/120) = 5d/120 = d/24. Then average speed = 2d / (d/24) = 48 km/h.
FAQ · 7 QUESTIONS

Frequently Asked Questions

01
What is Time Speed Distance Problems in simple terms?
02
Why do I keep getting wrong answers when I use D = ST directly?
03
How do I tell when to use relative speed?
04
What's the fastest way to solve TSD problems in an interview?
05
Is the harmonic mean always correct for average speed?
06
How do I handle problems where speed changes during the journey?
07
What's the difference between two trains passing toward each other vs one overtaking the other?
🔥

That's Aptitude. Mark it forged?

5 min read · try the examples if you haven't

Previous
Profit and Loss Problems
4 / 14 · Aptitude
Next
Probability Problems