Algebra
How To Solve A System Of Linear Equations
Two equations with two unknowns have a single solution whenever the two lines cross at exactly one point, and Cramer's rule finds that point with nothing more than determinants.
Quick Answer
D = a1 b2 - a2 b1
- a1, b1, c1
- The coefficients and constant of the first equation
- a2, b2, c2
- The coefficients and constant of the second equation
- D
- The determinant of the coefficient matrix
- x, y
- The values that satisfy both equations at once
Put both equations in the form ax + by = c, then build the determinant from the four coefficients. For 2x + 3y = 13 and 4x - y = 5 the determinant is -14, which gives x = 2 and y = 3. Substituting those values back into the first equation returns 13, confirming the solution.
What Is How To Solve A System Of Linear Equations?
A system of linear equations is a set of equations that must all be true at the same time. Two equations in two unknowns describe two straight lines, and the solution is the point where those lines cross. Written in the standard form ax + by = c, the pair has exactly one solution unless the lines are parallel or identical.
Cramer's rule solves the system by determinants rather than by eliminating one variable at a time. The determinant of the coefficients measures how far apart the two lines are in direction, and it appears in the denominator of both answers. When it is zero the lines are parallel or the same line, and there is no single crossing point.
The coefficient determinant is built from the four numbers that multiply the unknowns: a1 b2 minus a2 b1. For the pair 2x + 3y = 13 and 4x - y = 5 that is 2 times -1 minus 4 times 3, which is -14. The sign matters, and a determinant is allowed to be negative.
The numerator for x is formed by replacing the x coefficients with the constants, keeping the y coefficients where they are. That gives c1 b2 minus c2 b1, which for the example is 13 times -1 minus 5 times 3, or -28. Dividing by the determinant gives 2.
The numerator for y replaces the y coefficients with the constants instead, giving a1 c2 minus a2 c1. For the example that is 2 times 5 minus 4 times 13, or -42, and dividing by -14 gives 3. The symmetry between the two numerators is what makes the rule easy to remember once the pattern is clear.
A zero determinant means the two lines are parallel and therefore never meet, or that they are the same line and meet everywhere. In the first case the system is inconsistent and has no solution; in the second it has infinitely many. Either way there is no single pair of numbers to report, which is why the determinant has to be checked before dividing.
The quick way to spot the parallel case is to compare ratios. If the ratio of the x coefficients equals the ratio of the y coefficients, the lines have the same slope. If the ratio of the constants differs as well, they are parallel and distinct; if it matches too, the equations are the same line written twice.
Substituting the answer back into the original equations is the check that costs nothing and catches almost every arithmetic slip. A solution that satisfies one equation but not the other means the determinant or one of the numerators was built with the wrong coefficient. Both equations must return their stated constants.
The method extends to three equations in three unknowns, where the determinant is a three by three array and each numerator replaces one column with the constants. Beyond three the arithmetic grows quickly, and elimination methods or matrix factorisation take over. For a two by two system, Cramer's rule is about as direct as it gets.
Graphing the two lines makes the meaning of the determinant concrete. Two lines with different slopes cross once, and the determinant is the quantity that encodes the difference in slope. Two lines with the same slope never cross unless they are identical, and that is exactly when the determinant vanishes.
Formula
D = a1 b2 - a2 b1
Built from the four coefficients that multiply the unknowns. It appears in the denominator of both solutions, so it must be non-zero for a unique answer to exist.
| Symbol | Meaning | Unit | Notes |
|---|---|---|---|
| a1 | x coefficient in the first equation | dimensionless | The number multiplying x in equation one. |
| b1 | y coefficient in the first equation | dimensionless | The number multiplying y in equation one. |
| a2 | x coefficient in the second equation | dimensionless | The number multiplying x in equation two. |
| b2 | y coefficient in the second equation | dimensionless | The number multiplying y in equation two. |
| D | Determinant | dimensionless | Zero means the lines are parallel or identical. |
x = (c1 b2 - c2 b1) / D
The constants replace the x coefficients in the numerator, while the y coefficients stay in place. Divide by the determinant to get x.
| Symbol | Meaning | Unit | Notes |
|---|---|---|---|
| c1 | Constant in the first equation | dimensionless | The right hand side of equation one. |
| c2 | Constant in the second equation | dimensionless | The right hand side of equation two. |
| b1 | y coefficient in the first equation | dimensionless | Unchanged from the determinant. |
| b2 | y coefficient in the second equation | dimensionless | Unchanged from the determinant. |
| D | Determinant | dimensionless | Computed from the coefficients before either unknown. |
y = (a1 c2 - a2 c1) / D
This time the constants replace the y coefficients and the x coefficients stay. The pattern mirrors the formula for x.
| Symbol | Meaning | Unit | Notes |
|---|---|---|---|
| a1 | x coefficient in the first equation | dimensionless | Unchanged from the determinant. |
| a2 | x coefficient in the second equation | dimensionless | Unchanged from the determinant. |
| c1 | Constant in the first equation | dimensionless | Substituted in place of the y coefficient. |
| c2 | Constant in the second equation | dimensionless | Substituted in place of the y coefficient. |
| D | Determinant | dimensionless | The same value used for x. |
How To Calculate How To Solve A System Of Linear Equations
- 1
Write both equations in standard form
Each equation must read ax + by = c, with the unknowns on the left in that order and the constant alone on the right. Rearranging first prevents coefficients from being read off in the wrong order.
- 2
Build the determinant from the coefficients
Multiply the first x coefficient by the second y coefficient and subtract the second x coefficient times the first y coefficient. For 2x + 3y = 13 and 4x - y = 5 that is 2 times -1 minus 4 times 3, giving -14.
- 3
Check that the determinant is not zero
A zero determinant means the lines are parallel or identical, so there is no single solution. Comparing the ratio of the x coefficients with the ratio of the y coefficients reveals the parallel case before any division is attempted.
- 4
Replace the x column with the constants
Keep the y coefficients where they are and put the two constants in the x column. The numerator is c1 b2 minus c2 b1, which for the example is -28, and dividing by -14 gives x = 2.
- 5
Replace the y column and check the answer
Swap the constants into the y column for a numerator of a1 c2 minus a2 c1, giving y = 3. Substitute both values back into the original equations; each must return its stated constant.
Examples
Example 1: 2x + 3y = 13 and 4x - y = 5
- a1
- 2
- b1
- 3
- c1
- 13
- a2
- 4
- b2
- -1
- c2
- 5
| Step | Calculation | Result |
|---|---|---|
| a1 times b2 | 2 x -1 | -2 |
| a2 times b1 | 4 x 3 | 12 |
| Determinant | -2 - 12 | -14 |
| Value of x | (13 x -1 - 5 x 3) / -14 | 2 |
| Value of y | (2 x 5 - 4 x 13) / -14 | 3 |
Result: The determinant is -14, so the two lines cross at x = 2 and y = 3, which satisfies both original equations.
Example 2: A sum and a difference
- a1
- 1
- b1
- 1
- c1
- 10
- a2
- 1
- b2
- -1
- c2
- 4
| Step | Calculation | Result |
|---|---|---|
| Determinant | 1 x -1 - 1 x 1 | -2 |
| Value of x | (10 x -1 - 4 x 1) / -2 | 7 |
| Value of y | (1 x 4 - 1 x 10) / -2 | 3 |
| Check against the first equation | 7 + 3 | 10 |
Result: With x = 7 and y = 3 the first equation gives 10 and the second gives 4, matching both stated constants.
Example 3: A pair of parallel lines
- a1
- 2
- b1
- 4
- c1
- 6
- a2
- 1
- b2
- 2
- c2
- 5
| Step | Calculation | Result |
|---|---|---|
| Ratio of the x coefficients | 2 / 1 | 2 |
| Ratio of the y coefficients | 4 / 2 | 2 |
| Ratio of the constants | 6 / 5 | 1.2 |
| Determinant | 2 x 2 - 1 x 4 | 0 |
Result: The x and y coefficients share the ratio 2 while the constants give 1.2, so the lines are parallel and the determinant is 0, meaning no unique solution exists.
Calculator
Value of x
2
- Value of y
- 3
- Determinant of the coefficients
- -14
- First equation with the solved values
- 13
Values update as you type. This calculator covers the single scenario its formula assumes — see Common Mistakes for what it leaves out.
Prefer a full-width tool? Open the How To Solve A System Of Linear Equations calculator page.
Common Mistakes
Dividing by a zero determinant
When the determinant is zero the two lines are parallel or identical, so there is no single solution to report. Dividing anyway produces a pair of numbers that satisfies neither equation, and nothing on the page flags them as meaningless.
Computing an unknown before the determinant
Both numerators are divided by the determinant, so the determinant has to be established first. Working out x before checking that the determinant is non-zero risks building an answer on a denominator that makes it invalid.
Swapping the x and y numerators
The numerator for x replaces the x coefficients with the constants, and the numerator for y replaces the y coefficients. Swapping them produces two values that look plausible but satisfy neither equation.
Losing a sign when a coefficient is negative
A negative coefficient is easy to drop when substituting. In the example the first y coefficient is -1, and treating it as 1 changes the determinant from -14 to 10 and both answers with it.
Assuming every pair of equations has a solution
Two equations in two unknowns can have one solution, no solution, or infinitely many. The determinant distinguishes the cases, and ignoring it means reporting an answer for a system that has none.
Rounding the determinant before dividing
The determinant is a denominator, so an error in it propagates into both unknowns. Keep it exact through the division and round only the final values to the precision the inputs justify.
FAQ
What is Cramer's rule?
A method for solving a system of linear equations using determinants. Build the determinant of the coefficients, then form a numerator for each unknown by replacing that unknown's column with the constants. Each unknown is its numerator divided by the determinant.
What does a zero determinant mean?
It means the two lines are either parallel and never meet, or identical and meet everywhere. In the first case the system has no solution; in the second it has infinitely many. Either way there is no single pair of values to report.
Can a system of two equations have more than one solution?
Yes, when the two equations describe the same line. That happens when all three ratios, of the x coefficients, the y coefficients and the constants, are equal. The determinant is zero and every point on the line satisfies both equations.
How do I check the answer?
Substitute both values back into the original equations. Each must return its stated constant. If one works and the other does not, a numerator or the determinant was built with the wrong coefficient, and the check localises the error quickly.
Does Cramer's rule work for three unknowns?
Yes. The determinant becomes a three by three array and each numerator replaces one column with the constants. The arithmetic grows quickly, so for larger systems elimination methods or matrix factorisation are usually preferred in practice.
What if the equations are not in the form ax + by = c?
Rearrange them first. Move every term containing an unknown to the left, in the order x then y, and leave the constant alone on the right. Reading coefficients off an unrearranged equation is the most common source of a swapped or mis-signed value.
References
- [1]Wikipedia, System of linear equations — https://en.wikipedia.org/wiki/System_of_linear_equations
- [2]Wikipedia, Cramer's rule — https://en.wikipedia.org/wiki/Cramer%27s_rule
- [3]Wikipedia, Determinant — https://en.wikipedia.org/wiki/Determinant