Systems of Linear Equations
Systems of Linear Equations
Definition: A system of linear equations is a set of two or more linear equations considered together, where a solution is a set of values, one per variable, that makes every equation in the system true at the same time.
How It Works
- A system of linear equations groups two or more linear equations together and asks for the values that satisfy all of them simultaneously, not just one at a time.
- For two equations in two variables, x and y, each equation graphs as a straight line, so solving the system geometrically means finding every point that lies on both lines at once.
- If the two lines have different slopes, they cross at exactly one point, and the system has exactly one solution: the single (x, y) pair the lines share.
- If the two lines have the same slope but different y-intercepts, they are parallel and never meet, so the system has no solution.
- If the two lines have the same slope and the same y-intercept, they are the same line written two different ways, so every point on it satisfies both equations, giving infinitely many solutions.
- Substitution solves one equation for one variable in terms of the other, then plugs that expression into the second equation, collapsing two equations in two unknowns into one equation in one unknown.
- Elimination (the addition method) multiplies one or both equations by constants so a variable’s coefficients become opposites, then adds the equations together so that variable cancels out entirely.
- Graphing plots both lines on the same axes and reads the solution off wherever they cross; it is the most intuitive method but only as precise as the drawing.
- All three methods answer the identical question, for which x and y are both equations true at once, so a correct solution found by any one of them must agree with the other two.
- A candidate solution should always be checked in both original equations, not just the one used last, since an early slip can produce a pair that satisfies only one of them.
- A system’s coefficients form a matrix, and that matrix’s determinant is zero exactly when the system has no unique solution (the no-solution or infinite-solutions case), tying solvability directly to the matrix.
Illustration
var m1In = document.getElementById(‘sys-m1’); var b1In = document.getElementById(‘sys-b1’); var m2In = document.getElementById(‘sys-m2’); var b2In = document.getElementById(‘sys-b2’); var m1Out = document.getElementById(‘sys-m1-out’); var b1Out = document.getElementById(‘sys-b1-out’); var m2Out = document.getElementById(‘sys-m2-out’); var b2Out = document.getElementById(‘sys-b2-out’); var resetBtn = document.getElementById(‘sys-reset’);
function fmt(n) { return (Math.round(n * 100) / 100).toFixed(2).replace(/.00$/, ‘.0’); }
// A straight line only needs its true endpoints, but sampling across the // visible range and clamping y keeps the path data well-behaved even for // the steepest sliders, matching how the curve in Quadratic Equations and // Functions handles the same problem. function pathFor(m, b) { var pts = []; for (var x = -10; x <= 10.001; x += 0.25) { var y = m * x + b; if (y > 12) y = 12; if (y < -12) y = -12; var p = toPx(x, y); pts.push((pts.length === 0 ? ‘M’ : ‘L’) + p[0].toFixed(1) + ’,’ + p[1].toFixed(1)); } return pts.join(’ ’); }
function update() { var m1 = parseFloat(m1In.value); var b1 = parseFloat(b1In.value); var m2 = parseFloat(m2In.value); var b2 = parseFloat(b2In.value); m1Out.textContent = fmt(m1); b1Out.textContent = fmt(b1); m2Out.textContent = fmt(m2); b2Out.textContent = fmt(b2);
line1.setAttribute('d', pathFor(m1, b1));
line2.setAttribute('d', pathFor(m2, b2));
eq1Txt.textContent = 'Line 1: y = ' + fmt(m1) + 'x + ' + fmt(b1);
eq2Txt.textContent = 'Line 2: y = ' + fmt(m2) + 'x + ' + fmt(b2);
// Slider steps (0.25 for slope, 0.5 for intercept) land on exact
// values, so "equal" slopes can occur exactly; a small epsilon still
// guards the comparison against any stray floating-point noise.
var EPS = 0.001;
if (Math.abs(m1 - m2) < EPS) {
point.setAttribute('visibility', 'hidden');
if (Math.abs(b1 - b2) < EPS) {
statusTxt.textContent = 'Infinitely many solutions (same line)';
} else {
statusTxt.textContent = 'No solution (parallel lines)';
}
} else {
var x = (b2 - b1) / (m1 - m2);
var y = m1 * x + b1;
var p = toPx(x, Math.max(-12, Math.min(12, y)));
point.setAttribute('cx', p[0]);
point.setAttribute('cy', p[1]);
point.setAttribute('visibility', 'visible');
statusTxt.textContent = 'One solution: (' + fmt(x) + ', ' + fmt(y) + ')';
}
}
[m1In, b1In, m2In, b2In].forEach(function (el) { el.addEventListener(‘input’, update); }); resetBtn.addEventListener(‘click’, function () { m1In.value = 1; b1In.value = 0; m2In.value = -1; b2In.value = 4; update(); });
update(); })();
Under the Hood
The elimination method is easiest to see in standard form (Ax + By = C for each equation) rather than the slope-intercept form used in the widget above, since standard form is also how a system’s coefficient matrix is built. Solving a general 2x2 system by elimination:
a1x + b1y = c1
a2x + b2y = c2
Multiply the first equation by b2 and the second by b1 so the y-terms match:
a1b2x + b1b2y = c1b2
a2b1x + b1b2y = c2b1
Subtract the second from the first to eliminate y:
(a1b2 - a2b1)x = c1b2 - c2b1
Solve for x, provided a1b2 - a2b1 ≠ 0:
x = (c1b2 - c2b1) / (a1b2 - a2b1)
Substitute that x back into either original equation to solve for y.
- The quantity a1b2 - a2b1 is exactly the determinant of the coefficient matrix [[a1, b1], [a2, b2]]; it is nonzero precisely when elimination can produce a single value of x, which is the same condition for the system to have a unique solution.
Worked Example 1: Solving by substitution. Given: x + y = 7 and y = 2x + 1. Step 1: substitute the second equation into the first: x + (2x + 1) = 7. Step 2: 3x + 1 = 7, so 3x = 6 and x = 2. Step 3: y = 2(2) + 1 = 5. Answer: x = 2, y = 5 (check: 2 + 5 = 7, and 5 = 2(2) + 1).
Worked Example 2: Solving by elimination. Given: x + 2y = 8 and 3x - y = 3. Step 1: multiply the second equation by 2 so the y-coefficients become opposites: 6x - 2y = 6. Step 2: add this to the first equation: (x + 2y) + (6x - 2y) = 8 + 6, so 7x = 14 and x = 2. Step 3: substitute x = 2 into the first original equation: 2 + 2y = 8, so y = 3. Answer: x = 2, y = 3 (check: 3(2) - 3 = 3).
Worked Example 3: No solution (parallel lines). Given: y = 2x + 3 and y = 2x - 1. Step 1: set the two expressions for y equal, since both must hold at once: 2x + 3 = 2x - 1. Step 2: subtracting 2x from both sides leaves 3 = -1, which is false for any x. Answer: no solution; the lines share slope 2 but have different y-intercepts (3 and -1), so they run parallel and never cross.
Worked Example 4: Infinitely many solutions (same line). Given: y = 3x - 2 and 2y = 6x - 4. Step 1: divide the second equation through by 2: y = 3x - 2. Answer: infinitely many solutions; the second equation is just the first one scaled by 2, so it describes the exact same line and every point on it satisfies both equations.
History
- The Chinese text The Nine Chapters on the Mathematical Art (c. 200 BCE - 100 CE) already lays out systems of linear equations solved with a counting-rod array method that is essentially Gaussian elimination, roughly 1800 years before Gauss’s name became attached to it.
- The method is named after the German mathematician Carl Friedrich Gauss for his early 19th-century systematic use of it, not because he invented the underlying idea, which long predates him.
- Gauss’s own use of elimination grew out of practical necessity: fitting orbits and processing surveying data for geodesy routinely produced large systems of linear equations that had to be solved by hand.
- Swiss mathematician Gabriel Cramer published Cramer’s rule, a method for solving systems using determinants, in 1750, giving each variable directly as a ratio of two determinants.
- The determinant itself predates Cramer’s systematic treatment; mathematicians in both Japan and Europe were already working with determinant-like quantities for solving systems in the late 17th century.
- Formal matrix notation, treating a system’s coefficients as a single object that can be manipulated as a whole, was not developed until the 19th century, after both elimination and Cramer’s rule were already in common use.
Why It Matters
- Market equilibrium in economics, the price and quantity at which supply equals demand, is literally the solution to a system of two linear equations, one for the supply curve and one for the demand curve.
- Circuit analysis in electrical engineering turns Kirchhoff’s current and voltage laws into a system of linear equations, one per loop or node, that must be solved together to find every unknown current and voltage.
- Computer graphics and 3D rendering solve large systems of linear equations constantly, for tasks like mesh deformation, physics simulation, and lighting, almost always through matrix methods rather than by hand.
- Linear programming, used across business and logistics to minimize cost or maximize output, optimizes a linear objective subject to a whole system of linear constraint equations and inequalities.
- Structural engineers write a force-balance equation at every joint of a truss or frame, and solving that system of linear equations gives the internal forces the structure has to be built to withstand.
- Balancing a chemical equation with several unknown coefficients is itself a system of linear equations, one equation per element that has to balance on both sides.
Common Pitfalls
- Sign errors during elimination, especially dropping or flipping a negative sign while multiplying an equation through by a constant, are one of the most common sources of a wrong final answer.
- Finding an (x, y) pair and stopping without checking it in both original equations; an earlier arithmetic slip can produce a pair that satisfies only one of them.
- Seeing two equations with the same slope and immediately assuming “no solution” without also comparing the intercepts; same slope and same intercept means the equations describe the same line, giving infinitely many solutions instead.
- Multiplying only one side of an equation by a constant during elimination, instead of every term on both sides, which silently breaks the equation’s balance.
- Applying the two-variable substitution or elimination steps directly to a system with three or more variables without adapting them; larger systems need elimination applied repeatedly to remove one variable at a time.
- Forgetting that multiplying or dividing an entire equation by a nonzero constant never changes its solution set, so two equations that look different on paper can still represent the exact same line.
Comparison
| Method | Best When | Gives Directly |
|---|---|---|
| Substitution | One equation is already solved for a variable, or is easy to rearrange that way | Exact algebraic solution |
| Elimination | Both equations are in standard form with matching or easily-matched coefficients | Exact algebraic solution |
| Graphing | You want a quick visual read on the system, or need to sanity-check an algebraic answer | Approximate solution, plus the solution type at a glance |
FAQ
What changes for a system with three equations and three variables? The same idea applies, values that satisfy every equation at once, but solving it means eliminating one variable at a time across pairs of equations until a single equation in one unknown is left, then back-substituting. This repeated elimination is exactly what Gaussian elimination formalizes for systems of any size.
Can a system of two linear equations have exactly two solutions? No. Two distinct straight lines either cross once, never cross, or are the same line, so a two-variable linear system’s solution count is always exactly one, zero, or infinite. Landing on some other count means an arithmetic error, not a fourth possibility.
Does it matter which variable I eliminate first? No, the final solution comes out the same either way. Eliminating x first versus y first just changes what the intermediate algebra looks like, not the answer.
Example
A small bakery sells muffins for 4. On a day it sold 50 items total and took in $178, the number of muffins m and scones s satisfy the system m + s = 50 and 3m + 4s = 178. Multiplying the first equation by 3 and subtracting it from the second eliminates m, leaving s = 28, and then m = 22 follows from the first equation, the same one-solution case that this note’s widget marks with a single intersection point.