Why This Matters
The hardest part of algebra is not solving equations -- it is knowing which equation to write. Mathematical modeling is the skill of translating a real-world situation into algebraic form. "A train leaves Chicago traveling 60 mph" becomes d = 60t. "You mix 3 liters of 20% solution with some amount of 50% solution" becomes 0.20(3) + 0.50(x) = concentration times total volume. The algebra is straightforward once the equation is set up correctly.
Rate problems involve distance, speed, and time connected by d = rt. Two cars driving toward each other, a swimmer going upstream and downstream, or a worker completing a job at a certain pace all reduce to rate equations. Mixture problems deal with combining ingredients of different concentrations, prices, or percentages to achieve a target blend.
In programming, word problems are everywhere -- but we call them "requirements." A product manager says "we need the server to handle 1000 requests per second with a 99th percentile latency under 50ms." Translating that into a model, identifying the constraints, and solving is exactly the same skill as translating a word problem into algebra.
Define Terms
Visual Model
The full process at a glance. Click Start tour to walk through each step.
Word problems follow a systematic pipeline: identify unknowns, translate to equations, solve, and verify.
Code Example
// Rate-Distance-Time: d = r * t
// Problem: Two cars start 300 miles apart driving toward each other
// Car A goes 60 mph, Car B goes 40 mph. When do they meet?
function whenDoTheyMeet(distance, speedA, speedB) {
// Combined speed (approaching each other)
const combinedSpeed = speedA + speedB;
const time = distance / combinedSpeed;
const distA = speedA * time;
const distB = speedB * time;
console.log(`They meet after ${time} hours`);
console.log(`Car A travels ${distA} miles`);
console.log(`Car B travels ${distB} miles`);
console.log(`Total: ${distA + distB} miles (should equal ${distance})`);
return time;
}
whenDoTheyMeet(300, 60, 40);
// Mixture problem: How much 80% solution to add to 5L of 30%
// to get a 50% solution?
function mixtureSolve(vol1, conc1, conc2, targetConc) {
// vol1 * conc1 + x * conc2 = (vol1 + x) * targetConc
// Solve for x:
const x = (vol1 * (targetConc - conc1)) / (conc2 - targetConc);
console.log(`\nAdd ${x.toFixed(2)} liters of ${conc2 * 100}% solution`);
console.log(`Total volume: ${(vol1 + x).toFixed(2)} liters`);
// Verify
const totalSolute = vol1 * conc1 + x * conc2;
const resultConc = totalSolute / (vol1 + x);
console.log(`Result concentration: ${(resultConc * 100).toFixed(1)}%`);
return x;
}
mixtureSolve(5, 0.30, 0.80, 0.50);
// General rate-distance-time solver
function solveRDT(known) {
// Given any two of {rate, distance, time}, find the third
if (known.rate && known.time) {
return { ...known, distance: known.rate * known.time };
} else if (known.distance && known.time) {
return { ...known, rate: known.distance / known.time };
} else if (known.rate && known.distance) {
return { ...known, time: known.distance / known.rate };
}
}
console.log("\nRate problem:", solveRDT({ rate: 65, time: 3 })); // d=195
console.log("Rate problem:", solveRDT({ distance: 200, time: 4 })); // r=50Interactive Experiment
Try these exercises:
- A train travels at 80 mph for some time, then 60 mph for 2 hours longer, covering 420 miles total. Set up and solve.
- You have 10 liters of 40% salt solution. How much pure water (0%) must you add to dilute it to 25%?
- Two pipes fill a pool: pipe A fills it in 6 hours, pipe B in 4 hours. How long do they take together?
- A phone plan charges $30/month plus $0.10 per text. Another charges $50/month with unlimited texts. At how many texts per month are they equal?
Quick Quiz
Coding Challenge
Write a function called `solveRateDistanceTime` that takes an object with two of the three properties: rate (speed), distance, and time. Return the missing value. Use the formula d = r * t. For example, solveRateDistanceTime({rate: 60, time: 3}) should return 180 (the distance). solveRateDistanceTime({distance: 200, time: 4}) should return 50 (the rate).
Real-World Usage
Translating real-world constraints into solvable models is a universal skill:
- Project planning: "We have 3 developers and need to ship 45 features. At 3 features per developer per sprint, how many sprints?" is a rate problem.
- Capacity planning: "Our server handles 500 requests/sec. Traffic is growing 20% monthly. When do we need to upgrade?" requires algebraic modeling.
- Financial planning: "How long to save $50,000 at $1,200/month with 5% annual interest?" is a word problem that models compound growth.
- Recipe scaling: Doubling a recipe while substituting ingredients at different ratios is a mixture problem.
- Logistics: Optimizing delivery routes with constraints on distance, speed, and time windows uses the same d = rt reasoning.