Time & Work
Scenario
Imagine two developers: Dev A can finish an API in 10 days, Dev B in 15 days. If they pair program, how fast does it ship? This is the exact math tech companies test you on.
Mental model
Work = Time x Rate. Instead of adding days, add their per-day speed (rates).
Never add time directly. If A takes 10 days and B takes 15 days, they do not take 25 days together. Convert everything to 'work done per day' (efficiency) and add those rates.
Formula
If A takes x days and B takes y days, together they take (x x y) / (x + y) days. Rate of A = 1/x per day. Work done in t days = t / x. For 3+ workers: use LCM method - assume total work = LCM of their individual times, assign each worker their units per day, sum the rates. If A is k times as efficient as B, A takes time = B's time / k. Work remaining after t days of one worker = 1 - (t/x).
The formula (xy)/(x+y) is the algebraic simplification of 1/(1/x + 1/y). For 3+ people, the LCM method is faster: set total work = LCM of given days, compute each person's daily output, sum outputs, then divide total by combined daily output.
Pattern discovery
Calculate A and B's combined rate, then find time.
- A takes 10 days -> Rate = 1/10 work/day
- B takes 15 days -> Rate = 1/15 work/day
- Together -> 1/10 + 1/15 = 3/30 + 2/30 = 5/30 = 1/6 work/day
- Time together -> 6 days
Why do you add rates (1/10 + 1/15) and not times (10 + 15)?
Rule: To find combined time, add their individual rates (reciprocals of time), then flip it back. Rates add; times do not.
Worked example
Problem: A can complete a piece of work in 12 days. B is 50% more efficient than A. How long do they take to finish together?
- A's rate = 1/12 work per day. B is 50% more efficient: B's rate = 1.5 x (1/12) = 1/8 per day.
- Combined rate = 1/12 + 1/8 = 2/24 + 3/24 = 5/24 per day.
- Time = 1 / (5/24) = 24/5 = 4.8 days.
- Sanity-check via LCM method: LCM(12, 8) = 24 units. A does 2 units/day, B does 3 units/day. Together 5 units/day. Time = 24/5 = 4.8 days. Matches.
Answer: 4.8 days (24/5 days).
Problem: X and Y together finish a job in 6 days. X alone takes 10 days. After X and Y work together for 3 days, X leaves. How many more days will Y take to finish?
- X's rate = 1/10, Y's rate = 1/6 - 1/10 = 5/30 - 3/30 = 2/30 = 1/15. Y alone takes 15 days.
- Work done in 3 days together = 3 x (1/6) = 1/2.
- Remaining work = 1 - 1/2 = 1/2.
- Y alone does 1/15 per day. Time for Y to finish 1/2 = (1/2) / (1/15) = 15/2 = 7.5 days.
- Sanity-check: 7.5 x (1/15) = 0.5. Remaining work matches.
Answer: Y needs 7.5 more days.
Shortcuts
- The LCM (Chocolate) Method: Assume total work = LCM of given days. Calculate work units done per day by each person. (A=10 days, B=15 days. LCM=30 chocolates. A eats 3/day, B eats 2/day. Together 5/day. 30/5 = 6 days.)
Common mistakes
- Adding Days Directly: Assuming A(10 days) + B(15 days) = 25 days. More workers means LESS time, not more. Always add rates, not times.
Glossary
- efficiency
- How much work a person or machine can get done in a certain amount of time.
- algebraic
- Using letters and formulas in math to solve problems.
- output
- The amount of work produced or finished in a day.
Recall questions
- If P takes 20 days and Q takes 30 days, what is their combined time using the formula (x*y)/(x+y)?
- What is the assumed total work (LCM) for workers taking 12, 15, and 20 days?
- If A completes 1/3 of the work in 5 days, how many days for the full work?
Questions & answers
A can do a piece of work in 8 days. B is 3 times as efficient as A. In how many days can they complete it together?
2 days
Approach: LCM method: total work = 8 units. A does 1 unit/day, B does 3 units/day (3x efficient). Together = 4 units/day. Time = 8/4 = 2 days.
A takes 15 days and B takes 20 days. They work together for 4 days, then A leaves. How many days will B take to finish the remaining work?
10.67 days
Approach: LCM(15,20) = 60 units. A=4/day, B=3/day. In 4 days together: (4+3)*4 = 28 units done. Remaining = 32 units. B takes 32/3 = 10.67 days.
Continue learning
Next: Pipes & Cisterns