Skip to main content
ponderloop

System of Equations Calculator

2x + 3y = 7 and 4x − y = 5 have exactly one solution: x = 11/7, y = 9/7 (x ≈ 1.5714, y ≈ 1.2857), the point where the two lines cross. To solve a system by hand, row-reduce the augmented matrix [2 3 | 7; 4 −1 | 5] until the left side is the identity matrix (Gaussian elimination), or use Cramer’s rule: here D = −14, x = Dx / D = −22 / −14 = 11/7; y = Dy / D = −18 / −14 = 9/7. If D = 0 there is no single solution: x + y = 2 and 2x + 2y = 5 are parallel lines with no solution, while x + y = 2 and 2x + 2y = 4 are the same line, so x = 2 − t, y = t. Three equations in three unknowns work the same way: 2x + y − z = 8, −3x − y + 2z = −11, −2x + y + 2z = −3 gives x = 2, y = 3, z = −1. This calculator keeps every answer as an exact fraction, shows each row operation, and graphs the two lines.

Updated Runs in your browser: nothing you enter is uploadedHow this tool works

Size of the system

Enter each equation as ax + by [+ cz] = d. Put 0 for a missing variable. Whole numbers, decimals like 0.75 and fractions like 3/4 all work.

Bigger systems, or a matrix to invert: use the matrix calculator.

2x + 3y = 7 · 4x − y = 5

x = 11/7, y = 9/7

Exactly one pair (x, y) satisfies both equations.

Solution as decimals
x ≈ 1.5714, y ≈ 1.2857
Determinant D = det(A)
−14
Dx (x column replaced by the constants)
−22
Dy (y column replaced by the constants)
−18
Cramer’s rule
x = Dx / D = −22 / −14 = 11/7; y = Dy / D = −18 / −14 = 9/7
Rank of A
2
Rank of [A | d]
2
Geometric reading
The two lines cross at exactly one point, (11/7, 9/7).

Graph of the two lines

Graph of the two lines in the systemGraph of the lines 2x + 3y = 7 and 4x − y = 5. The two lines cross at exactly one point, (11/7, 9/7).00.511.5−0.500.511.5xyEq 1Eq 2(11/7, 9/7)
Line 1 is solid and line 2 is dashed. A dot marks the point where they cross. Graph of the lines 2x + 3y = 7 and 4x − y = 5. The two lines cross at exactly one point, (11/7, 9/7).

The row reduction, step by step

  1. Write the system as an augmented matrix [A | d]: one row per equation, the coefficients of x, y first and the constant after the divider.
    Column 1Column 2Constant
    Equation 1237
    Equation 24−15
  2. R1 ← R1 ÷ 2, to make the pivot 1.
    Column 1Column 2Constant
    Equation 113/27/2
    Equation 24−15
  3. R2 ← R2 − 4·R1, to clear the pivot column.
    Column 1Column 2Constant
    Equation 113/27/2
    Equation 20−7−9
  4. R2 ← R2 ÷ (−7), to make the pivot 1.
    Column 1Column 2Constant
    Equation 113/27/2
    Equation 2019/7
  5. R1 ← R1 − (3/2)·R2, to clear the pivot column.
    Column 1Column 2Constant
    Equation 11011/7
    Equation 2019/7
  6. The left side is now the identity matrix, so the right column is the solution: x = 11/7, y = 9/7.
  7. Check by putting the solution back into each equation. Equation 1: 2·(11/7) + 3·(9/7) = 7, as required. Equation 2: 4·(11/7) + (−1)·(9/7) = 5, as required.
  8. Cramer’s rule uses the determinant D = ad − bc = 2·(−1) − 3·4 = −14.
  9. Replacing one column at a time by the constants gives Dx = −22, Dy = −18, so x = Dx / D = 11/7, y = Dy / D = 9/7: the same answer.

Worked examples: one, none or infinitely many solutions

Each row is a system run through the calculator above; type any of them to see its row reduction.
SystemWhat it showsOutcomeD = det(A)Solution
2x + 3y = 7; 4x − y = 5Two lines that crossOne solution−14x = 11/7, y = 9/7
2y = 4; x + y = 3Needs a row swap (a zero in the first pivot)One solution−2x = 1, y = 2
(1/2)x + (1/4)y = 3; x − y = 0Decimal coefficients (typed as 0.5 and 0.25)One solution−3/4x = 4, y = 4
(1/2)x + (1/3)y = 1; x − y = −1/2Fraction coefficients (typed as 1/2 and 1/3)One solution−5/6x = 1, y = 3/2
x + y = 2; 2x + 2y = 5Parallel linesNo solution0None
x + y = 2; 2x + 2y = 4The same line twiceInfinitely many solutions0x = 2 − t, y = t
2x + y − z = 8; −3x − y + 2z = −11; −2x + y + 2z = −3Three equations, one pointOne solution−1x = 2, y = 3, z = −1
x + y + z = 1; x + y + z = 2; x − y = 0Three equations that contradictNo solution0None
x + y + z = 3; 2x − y + z = 0; 3x + 2z = 3Three equations, a line of solutionsInfinitely many solutions0x = 1 − (2/3)t, y = 2 − (1/3)t, z = t
x + 2y + 3z = 6; 2x + 4y + 6z = 12; 3x + 6y + 9z = 18Three equations, a plane of solutionsInfinitely many solutions0x = 6 − 2s − 3t, y = s, z = t

What the determinant and the ranks tell you

D is the determinant of the coefficient matrix A; “rank” counts the independent rows after row reduction. The examples are computed by the calculator.
OutcomeDeterminantRanksTwo equationsThree equationsExamples
One solutionD is not 0rank A = rank [A | d] = number of unknownsThe lines cross at one pointThe planes meet at one point2 × 2: 2x + 3y = 7; 4x − y = 5 gives x = 11/7, y = 9/7 (rank of A 2, rank of [A | d] 2). 3 × 3: 2x + y − z = 8; −3x − y + 2z = −11; −2x + y + 2z = −3 gives x = 2, y = 3, z = −1 (rank of A 3, rank of [A | d] 3).
Infinitely many solutionsD is 0rank A = rank [A | d], less than the number of unknownsThe two equations are the same lineThe planes share a whole line, or are all the same plane2 × 2: x + y = 2; 2x + 2y = 4 gives x = 2 − t, y = t (rank of A 1, rank of [A | d] 1). 3 × 3: x + y + z = 3; 2x − y + z = 0; 3x + 2z = 3 gives x = 1 − (2/3)t, y = 2 − (1/3)t, z = t (rank of A 2, rank of [A | d] 2).
No solutionD is 0rank A is less than rank [A | d]The lines are parallelNo point lies on all three planes2 × 2: x + y = 2; 2x + 2y = 5 gives no solution (rank of A 1, rank of [A | d] 2). 3 × 3: x + y + z = 1; x + y + z = 2; x − y = 0 gives no solution (rank of A 2, rank of [A | d] 3).

How many unknowns stay free

Free variables = unknowns − rank of A, when the system has a solution. Each free variable becomes a parameter in the general solution.
SizeRank of AFree variablesSolutions formExampleResult
2 × 220A single point2x + 3y = 7; 4x − y = 5x = 11/7, y = 9/7
2 × 211A linex + y = 2; 2x + 2y = 4x = 2 − t, y = t
2 × 202The whole plane0 = 0; 0 = 0x = s, y = t
3 × 330A single point2x + y − z = 8; −3x − y + 2z = −11; −2x + y + 2z = −3x = 2, y = 3, z = −1
3 × 321A line in spacex + y + z = 3; 2x − y + z = 0; 3x + 2z = 3x = 1 − (2/3)t, y = 2 − (1/3)t, z = t
3 × 312A plane in spacex + 2y + 3z = 6; 2x + 4y + 6z = 12; 3x + 6y + 9z = 18x = 6 − 2s − 3t, y = s, z = t
3 × 303All of space0 = 0; 0 = 0; 0 = 0x = r, y = s, z = t

How to solve a system of linear equations by row reduction

  1. Write every equation as ax + by = d. Move the variables to the left and the constant to the right, and put 0 for a missing variable. The example is 2x + 3y = 7 and 4x − y = 5; 2y = 4 and x + y = 3 has no x in its first equation, so that coefficient is 0.
  2. Build the augmented matrix [A | d]. Each row holds one equation: the coefficients, then the constant. The example becomes [2 3 | 7; 4 −1 | 5].
  3. Row-reduce to the identity matrix. Swap rows if a pivot is 0, divide a row to make its pivot 1, then subtract multiples of it from the other rows to clear its column. The first moves for the example are: R1 ← R1 ÷ 2, to make the pivot 1. R2 ← R2 − 4·R1, to clear the pivot column.
  4. Read the answer from the right-hand column. When the left side is the identity, the right column is the solution: x = 11/7, y = 9/7. A row that reads 0 = 1 means no solution, as for x + y = 2 and 2x + 2y = 5; a row of zeros leaves a free variable and infinitely many solutions, as for x + y = 2 and 2x + 2y = 4, where x = 2 − t, y = t.
  5. Check the solution in every equation. Check by putting the solution back into each equation. Equation 1: 2·(11/7) + 3·(9/7) = 7, as required. Equation 2: 4·(11/7) + (−1)·(9/7) = 5, as required.

Frequently asked questions

How do you solve a system of two equations with two unknowns?
Eliminate one unknown by adding a multiple of one equation to the other, solve for the other unknown, then substitute back. For 2x + 3y = 7 and 4x − y = 5 the calculator’s first two row operations are “R1 ← R1 ÷ 2” and “R2 ← R2 − 4·R1”, and the reduction ends with x = 11/7, y = 9/7. Substitution, elimination and row reduction always agree; the row-reduction form is the one that extends to three or more unknowns.
How do you solve three equations with three unknowns?
Use the same row reduction on a 3 × 3 system, clearing one column at a time. Choose “3 equations, 3 unknowns” and enter all twelve numbers. 2x + y − z = 8, −3x − y + 2z = −11, −2x + y + 2z = −3 reduces to x = 2, y = 3, z = −1, and the calculator confirms it by putting the values back into all three equations. The determinant of this system is −1, which is not 0, so the solution is unique.
What is Cramer’s rule, and when does it fail?
Cramer’s rule writes each unknown as a ratio of determinants: x = Dx / D, where D is the determinant of the coefficients and Dx is D with the x column replaced by the constants. For 2x + 3y = 7 and 4x − y = 5, x = Dx / D = −22 / −14 = 11/7; y = Dy / D = −18 / −14 = 9/7. It needs D ≠ 0. When D = 0 (as for x + y = 2; 2x + 2y = 5, where D = 0), dividing is impossible, and you have to find out by row reduction whether the system has no solution or infinitely many. It is also slow by hand for anything beyond 3 × 3.
How can I tell if a system has no solution or infinitely many?
Row-reduce and look at the rows with all-zero coefficients. A row that reads 0 = 1 contradicts itself: x + y = 2 and 2x + 2y = 5 gives no solution (rank of A 1, rank of [A | d] 2). A row that reads 0 = 0 only repeats information: x + y = 2 and 2x + 2y = 4 gives infinitely many solutions (rank of A 1, rank of [A | d] 1). In general, the system is consistent exactly when the rank of A equals the rank of [A | d] (the Rouché–Capelli theorem); then there is one solution if that rank equals the number of unknowns and infinitely many otherwise.
What does the determinant of the coefficient matrix tell me?
A non-zero determinant means the equations are independent, so there is exactly one solution (D = −14 for the example). A zero determinant means the rows are dependent: for two equations the lines are parallel or identical (D = 0 for x + y = 2; 2x + 2y = 5 and D = 0 for x + y = 2; 2x + 2y = 4); for three, the planes do not meet at a single point (D = 0 for x + y + z = 1; x + y + z = 2; x − y = 0). The determinant alone cannot say which of the two zero cases you are in; compare the ranks for that.
What does “infinitely many solutions” look like as an answer?
The answer is a recipe with a free parameter. For x + y + z = 3, 2x − y + z = 0, 3x + 2z = 3, row reduction leaves two independent equations for three unknowns, so z is free: call it t and the solution is x = 1 − (2/3)t, y = 2 − (1/3)t, z = t. Every t gives a point on a line in space, for example t = 0 gives (1, 2, 0); t = 1 gives (1/3, 5/3, 1). With only one independent equation, as in x + 2y + 3z = 6, 2x + 4y + 6z = 12, 3x + 6y + 9z = 18, two variables are free: x = 6 − 2s − 3t, y = s, z = t, and the solutions fill a plane.
Can I enter fractions and decimals?
Yes. Type an integer (3), a decimal (0.75) or a fraction (3/4) in any box; each is converted to an exact fraction, so nothing is rounded along the way. Typing 0.5 and 0.25 is the same as typing 1/2 and 1/4: (1/2)x + (1/4)y = 3 and x − y = 0 gives x = 4, y = 4. Fractions work the same way: (1/2)x + (1/3)y = 1 and x − y = −1/2 gives x = 1, y = 3/2. Percent signs, currency symbols and thousands commas are refused rather than guessed at.
What if a variable is missing from an equation?
Enter 0 for its coefficient. In 2y = 4 and x + y = 3 the first equation has no x term, so its x box holds 0; the solver swaps the rows to put a non-zero pivot on top and finds x = 1, y = 2. The same trick handles fewer equations than unknowns: pad the system with a row of zeros. Entering x + y + z = 6, x − y = 0, 0 = 0 gives infinitely many solutions, x = 3 − (1/2)t, y = 3 − (1/2)t, z = t.
Which method is best: substitution, elimination, graphing or matrices?
All of them give the same answer when one exists. Substitution is quick when one equation already isolates a variable. Elimination, written as row reduction, is the method that scales to three or more unknowns and reveals no-solution and infinite-solution cases cleanly. Graphing gives a picture for two unknowns but only approximate readings by eye. Cramer’s rule gives a closed formula for each unknown but needs a non-zero determinant. This calculator solves by row reduction, then shows Cramer’s rule, and for two unknowns the graph, as cross-checks.
What does the graph and the geometric reading show?
For two equations, each is a straight line. If the lines cross, the crossing point is the solution: for the example the calculator says “The two lines cross at exactly one point, (11/7, 9/7).” If they are parallel there is no common point: “The two lines are parallel (the same slope, different positions), so they never meet.” If they coincide, every point on the line is a solution: “Both equations describe the same line, so every point on that line is a solution.” For three equations each one is a plane in space, so there is no flat picture: the calculator reports the outcome and the working instead. The graph is drawn with equal scales on both axes, so slopes look like slopes, and line 2 is dashed so the two can be told apart without colour.
Why are the answers fractions instead of decimals?
Solving linear equations with whole-number coefficients produces ratios, and a fraction is the exact value: x = 11/7, y = 9/7 is exact, while x ≈ 1.5714, y ≈ 1.2857 is a rounding. The calculator shows the exact fraction first and the decimals underneath, marked ≈ when they are rounded. Using exact fractions also avoids the small errors that floating-point arithmetic can add when a system is nearly singular.

How it works

Each typed number is read as an exact fraction of two whole numbers (up to 12 digits on each side), so no rounding happens during the solution. The equations are written as an augmented matrix [A | d] and reduced by Gauss–Jordan elimination, which is Gaussian elimination carried on until every pivot is 1 and every other entry in its column is 0. For each column in turn the first row at or below the current one with a non-zero entry becomes the pivot row (swapped up if necessary), is divided by its pivot, and is subtracted, suitably multiplied, from every other row; each row operation is listed with the matrix it produces. After the reduction the rank of A is the number of pivots. A row with all-zero coefficients and a non-zero constant means no solution; otherwise, if the rank equals the number of unknowns the right-hand column is the unique solution, and if it is smaller the unknowns without a pivot are free: each is named by a parameter (t, or s and t) and the pivot unknowns are expressed in terms of them. The determinant of A is found by cofactor expansion along the first row, and Cramer’s determinants replace one column of A at a time by the constants; the answer from x = Dx / D is shown next to the row-reduction answer as a cross-check. For two equations the lines ax + by = d are drawn in a square window chosen from the exact crossing point or intercepts; the drawing uses ordinary floating point because a picture is approximate, while every number in the text is exact. The decimals line is rounded to at most 4 decimal places when the value does not end sooner, and is marked ≈ when it is rounded. Only systems with as many equations as unknowns (2 × 2 and 3 × 3) are accepted; for larger systems or for matrix operations see the matrix calculator.

Sources

More: Algebra and number theoryAll math & numbersAll toolsHome & DIY calculators