Enter 3 values and leave one field blank (or enter 'x') to solve for the missing variable.
:
=
:
function solveProportion() {
var a = document.getElementById('valA').value.trim();
var b = document.getElementById('valB').value.trim();
var c = document.getElementById('valC').value.trim();
var d = document.getElementById('valD').value.trim();
var resBox = document.getElementById('result-box');
var values = [a, b, c, d];
var emptyIndices = [];
for (var i = 0; i A = (B*C)/D
if (numD === 0) throw "Division by zero";
result = (numB * numC) / numD;
solveFor = "A";
document.getElementById('valA').value = result.toFixed(4).replace(/\.?0+$/, "");
} else if (emptyIndices[0] === 1) { // Solve for B: A/B = C/D => B = (A*D)/C
if (numC === 0) throw "Division by zero";
result = (numA * numD) / numC;
solveFor = "B";
document.getElementById('valB').value = result.toFixed(4).replace(/\.?0+$/, "");
} else if (emptyIndices[0] === 2) { // Solve for C: A/B = C/D => C = (A*D)/B
if (numB === 0) throw "Division by zero";
result = (numA * numD) / numB;
solveFor = "C";
document.getElementById('valC').value = result.toFixed(4).replace(/\.?0+$/, "");
} else if (emptyIndices[0] === 3) { // Solve for D: A/B = C/D => D = (B*C)/A
if (numA === 0) throw "Division by zero";
result = (numB * numC) / numA;
solveFor = "D";
document.getElementById('valD').value = result.toFixed(4).replace(/\.?0+$/, "");
}
resBox.innerHTML = "Solution Found! Value " + solveFor + " = " + result.toLocaleString(undefined, {maximumFractionDigits: 4});
resBox.className = "success";
resBox.style.display = "block";
} catch (e) {
resBox.innerHTML = "Mathematical Error: " + e;
resBox.className = "error";
resBox.style.display = "block";
}
}
function resetCalc() {
document.getElementById('valA').value = "";
document.getElementById('valB').value = "";
document.getElementById('valC').value = "";
document.getElementById('valD').value = "";
document.getElementById('result-box').style.display = "none";
}
Understanding Proportions and the Rule of Three
A proportion is a mathematical statement that asserts two ratios are equal. In its simplest form, it is written as A : B = C : D, or as two fractions: A/B = C/D. This tool, often called a "Rule of Three" calculator, allows you to find a missing value when three other components are known.
How the Proportional Calculation Works
The logic behind solving proportions is based on cross-multiplication. The product of the extremes (A and D) must equal the product of the means (B and C). This gives us the fundamental formula:
A × D = B × C
Depending on which value is missing, the formula is rearranged:
Solving for A: (B × C) / D
Solving for B: (A × D) / C
Solving for C: (A × D) / B
Solving for D: (B × C) / A
Real-World Examples of Proportions
1. Recipe Scaling (Cooking)
Suppose a recipe for 4 people requires 200 grams of flour. You want to cook for 10 people. What is the flour requirement?
A: 4 (Original People)
B: 200 (Original Flour)
C: 10 (New People)
D: x (New Flour)
Calculation: (200 × 10) / 4 = 500 grams.
2. Scale Maps and Models
A model car is built at a 1:24 scale. If the model car's length is 15 centimeters, how long is the real car?
If 5 Euros are worth 5.40 US Dollars, how many Euros will you get for 100 US Dollars?
A: 5 (Euros)
B: 5.40 (USD)
C: x (New Euros)
D: 100 (New USD)
Calculation: (5 × 100) / 5.40 = 92.59 Euros.
Direct vs. Inverse Proportion
This calculator solves for direct proportions, where one value increases as the other increases. In an inverse proportion, one value decreases as the other increases (for example, the more workers you have, the less time a job takes). For inverse proportions, the formula shifts to A × B = C × D.
Tips for Accurate Calculation
When using the proportional calculator, ensure that your units are consistent. If Value A is in "hours," Value C should also be in "hours." If Value B is in "miles," the resulting Value D will be in "miles." Mixing units (like minutes and hours) will result in an incorrect proportion unless you convert them to a common unit first.