Solve a system of two linear equations in the form: ax + by = c
Equation 1
x +y =
Equation 2
x +y =
Solution:
How to Use the System of Equations Calculator
This calculator solves for two unknown variables (x and y) using two linear equations. In mathematics, a system of equations is a collection of two or more equations involving the same set of variables. To find the solution, we must find the values for the variables that satisfy all equations in the system simultaneously.
Standard Form
Ensure your equations are in standard form before inputting the coefficients:
ax + by = c
dx + ey = f
Methods of Solving
Substitution: Solving one equation for one variable and plugging it into the second equation.
Elimination: Adding or subtracting the equations to eliminate one variable.
Cramer's Rule: A formulaic approach using determinants of matrices (this is the method our calculator uses for precision).
Example Calculation
Suppose you have the following system:
2x + 3y = 12
x – y = 1
Step 1: Enter a1=2, b1=3, c1=12.
Step 2: Enter a2=1, b2=-1, c2=1.
Step 3: Click Calculate. The result will show x = 3 and y = 2.
Understanding Special Cases
Not every system of equations has exactly one solution:
No Solution: Occurs when the lines are parallel. They never intersect.
Infinite Solutions: Occurs when both equations represent the exact same line (dependent equations).
function calculateSystem() {
var a1 = parseFloat(document.getElementById('coeff_a1').value);
var b1 = parseFloat(document.getElementById('coeff_b1').value);
var c1 = parseFloat(document.getElementById('const_c1').value);
var a2 = parseFloat(document.getElementById('coeff_a2').value);
var b2 = parseFloat(document.getElementById('coeff_b2').value);
var c2 = parseFloat(document.getElementById('const_c2').value);
var resultDiv = document.getElementById('equation-result');
var output = document.getElementById('solution-output');
if (isNaN(a1) || isNaN(b1) || isNaN(c1) || isNaN(a2) || isNaN(b2) || isNaN(c2)) {
resultDiv.style.display = 'block';
output.innerHTML = 'Please fill in all coefficient fields with valid numbers.';
return;
}
// Cramer's Rule calculation
// D = a1*b2 – a2*b1
// Dx = c1*b2 – c2*b1
// Dy = a1*c2 – a2*c1
var det = (a1 * b2) – (a2 * b1);
var detX = (c1 * b2) – (c2 * b1);
var detY = (a1 * c2) – (a2 * c1);
resultDiv.style.display = 'block';
if (det === 0) {
if (detX === 0 && detY === 0) {
output.innerHTML = 'Result: Infinite SolutionsThese equations describe the same line.';
} else {
output.innerHTML = 'Result: No SolutionThe lines are parallel and never intersect.';
}
} else {
var x = detX / det;
var y = detY / det;
// Format to 4 decimal places but remove trailing zeros
var xFormatted = Number(x.toFixed(4));
var yFormatted = Number(y.toFixed(4));
output.innerHTML = 'x = ' + xFormatted + 'y = ' + yFormatted + '' +
'Mathematical Verification:' +
'(' + a1 + ' × ' + xFormatted + ') + (' + b1 + ' × ' + yFormatted + ') = ' + c1 + " +
'(' + a2 + ' × ' + xFormatted + ') + (' + b2 + ' × ' + yFormatted + ') = ' + c2 + '';
}
}