What Is the Rule of Three?
The rule of three is a mathematical method to find an unknown value when you know three related values. It's based on proportional relationships: if A relates to B, then C relates to X.
The Formula
// Direct proportion
A --- B
C --- X
X = (B * C) / A
// Example: If 5 apples cost $3, how much do 8 apples cost?
// 5 --- 3
// 8 --- X
// X = (3 * 8) / 5 = $4.80Direct vs Inverse Proportion
| Type | Behavior | Example |
|---|---|---|
| Direct | Both values increase together | More items = higher cost |
| Inverse | One increases, other decreases | More workers = less time |
Inverse Rule of Three
// If 4 workers finish a job in 6 days,
// how long for 8 workers?
// 4 workers --- 6 days
// 8 workers --- X days
// X = (4 * 6) / 8 = 3 daysEveryday Applications
- Cooking: A recipe serves 4 but you need to serve 7. Scale all ingredients proportionally
- Shopping: Price per unit comparison. Which is cheaper: 500g for $5 or 750g for $7?
- Travel: If your car does 12 km/L, how much fuel for a 300km trip?
- Finance: If you earn $3,000/month working 40 hours/week, what's your hourly rate?
- Construction: If 50 tiles cover 8 square meters, how many tiles for 25 square meters?
In Programming
The rule of three appears everywhere in code:
// Mapping a value from one range to another
function mapRange(value, inMin, inMax, outMin, outMax) {
return outMin + (value - inMin) * (outMax - outMin) / (inMax - inMin);
}
// Progress bar: file download
const percent = (bytesDownloaded * 100) / totalBytes;Solve any proportion instantly with the PureTools Rule of Three Calculator. Enter three values, get the fourth. Supports both direct and inverse proportions.