Ace My Homework - Official Online Homework Help
Login
Ace My Homework - Official Online Homework Help
Math and Statistics

How to Solve Systems of Linear Equations: Methods and Examples

Super Writer
Written by
Super Writer

Last updated: Nov 23, 2026
Published: Apr 20, 2026
Share this post

If you are learning how to solve systems of linear equations, there are five standard methods: graphing, substitution, elimination, Cramer's rule and Gaussian elimination with a matrix. All five give the same answer. They differ in how much arithmetic they take and how well they scale past two variables.

This guide works one example with each method, then covers the special cases with no solution or infinitely many solutions, a three-variable system, a word problem and practice problems with answers. Every answer below has been checked by substituting it back into the original equations, which is also the last step of how to solve systems of linear equations by any method.

What a System of Linear Equations Is

A system of linear equations is two or more linear equations that share the same variables. A solution is a set of values, one for each variable, that makes every equation true at the same time. With two variables, each equation is a straight line, and the solution is the point where the lines cross.

Two lines can meet in only three ways, so every two-variable system has one of three outcomes:

LinesNumber of solutionsName
Cross at one pointExactly oneConsistent and independent
Parallel, never meetNoneInconsistent
Same lineInfinitely manyConsistent and dependent

The same three outcomes apply to larger systems, where each equation is a plane or a higher-dimensional flat surface. OpenStax College Algebra 2e uses these same labels in its chapter on systems.

Method 1: Solve by Graphing

Graphing shows what a solution means, so it is the usual first method in algebra courses. Use it when both equations are easy to put in slope-intercept form and the answer is likely to be whole numbers.

Example. Solve y = 2x − 1 and y = −x + 5.

  1. Graph the first line: y-intercept −1, slope 2. Points: (0, −1), (1, 1), (2, 3).
  2. Graph the second line: y-intercept 5, slope −1. Points: (0, 5), (1, 4), (2, 3).
  3. Both lists contain (2, 3), so the lines cross there.
  4. Check: 2(2) − 1 = 3 and −2 + 5 = 3. Both equations hold.

The solution is x = 2, y = 3. The weakness of graphing is precision: if the lines cross at (1.4, 2.7), you can only estimate it from a sketch. Use an algebraic method whenever exact values matter.

Method 2: Solve by Substitution

Substitution works best when one equation already has a variable with a coefficient of 1 or −1, so you can isolate it without fractions.

Example. Solve 2x + y = 7 and x − 3y = −7.

  1. Isolate y in the first equation: y = 7 − 2x.
  2. Substitute into the second: x − 3(7 − 2x) = −7.
  3. Simplify: x − 21 + 6x = −7, so 7x = 14 and x = 2.
  4. Back-substitute: y = 7 − 2(2) = 3.
  5. Check in the second equation: 2 − 3(3) = −7. Correct.

The most common error is dropping the parentheses in step 2. Writing x − 3 · 7 − 2x instead of distributing the −3 across both terms gives a wrong value for every variable after it.

Method 3: Solve by Elimination

Elimination, also called the addition method, adds or subtracts the equations so one variable cancels. It is usually the fastest by hand when no coefficient is 1.

Example. Solve 3x + 2y = 16 and 5x − 4y = 12.

  1. Pick a variable to cancel. The y-coefficients are 2 and −4, so multiply the first equation by 2: 6x + 4y = 32.
  2. Add it to the second equation: (6x + 4y) + (5x − 4y) = 32 + 12, so 11x = 44 and x = 4.
  3. Back-substitute into 3x + 2y = 16: 12 + 2y = 16, so y = 2.
  4. Check: 5(4) − 4(2) = 20 − 8 = 12. Correct.

When you multiply an equation, multiply every term, including the constant on the right. Forgetting the constant is the elimination version of the dropped-parentheses mistake.

Method 4: Cramer's Rule

Cramer's rule solves a square system with determinants. For a two-variable system ax + by = e and cx + dy = f, compute three determinants:

  • D = ad − bc (the coefficient determinant)
  • Dx: replace the x-column with the constants, giving ed − bf
  • Dy: replace the y-column with the constants, giving af − ec

Then x = Dx / D and y = Dy / D, as long as D is not zero.

Example. Solve 2x + 3y = 13 and 4x − y = 5.

  1. D = (2)(−1) − (3)(4) = −2 − 12 = −14.
  2. Dx = (13)(−1) − (3)(5) = −13 − 15 = −28.
  3. Dy = (2)(5) − (13)(4) = 10 − 52 = −42.
  4. x = −28 / −14 = 2 and y = −42 / −14 = 3.
  5. Check: 4(2) − 3 = 5. Correct.

Cramer's rule is tidy for 2 by 2 and 3 by 3 systems and gives a formula you can apply without thinking about which variable to eliminate. It becomes slow for larger systems, and if D = 0 it cannot be used: the system has no solution or infinitely many, and you need another method to tell which.

Solving a System with Three Variables

With three unknowns, you need three equations. The plan is to eliminate the same variable twice, which leaves a two-variable system you already know how to solve.

Example. Solve this system of equations:

  • (1) x + y + z = 6
  • (2) 2x − y + z = 3
  • (3) x + 2y − z = 2
  1. Eliminate z using (1) + (3): 2x + 3y = 8.
  2. Eliminate z again using (2) + (3): 3x + y = 5.
  3. Solve the new pair. From 3x + y = 5, y = 5 − 3x. Substitute: 2x + 3(5 − 3x) = 8, so −7x = −7 and x = 1. Then y = 2.
  4. Back-substitute into (1): 1 + 2 + z = 6, so z = 3.
  5. Check (2): 2 − 2 + 3 = 3. Check (3): 1 + 4 − 3 = 2. Both hold.

The solution is the ordered triple (1, 2, 3). Geometrically, it is the single point where three planes meet.

Method 5: Gaussian Elimination with an Augmented Matrix

Gaussian elimination is elimination written in matrix form. You drop the variable names, keep only the coefficients and constants, and apply three row operations until the matrix is in row echelon form (a staircase of zeros below the diagonal). It is the method computers use and the one that scales to any number of variables.

The three allowed row operations are: swap two rows, multiply a row by a nonzero number, and add a multiple of one row to another. None of them changes the solution.

Example. The same three-variable system as an augmented matrix, with each row written as [x, y, z | constant]:

StepOperationRow 1Row 2Row 3
Start—[1, 1, 1 | 6][2, −1, 1 | 3][1, 2, −1 | 2]
1R2 → R2 − 2R1; R3 → R3 − R1[1, 1, 1 | 6][0, −3, −1 | −9][0, 1, −2 | −4]
2Swap R2 and R3[1, 1, 1 | 6][0, 1, −2 | −4][0, −3, −1 | −9]
3R3 → R3 + 3R2[1, 1, 1 | 6][0, 1, −2 | −4][0, 0, −7 | −21]

Now read from the bottom up, which is called back substitution. Row 3 says −7z = −21, so z = 3. Row 2 says y − 2z = −4, so y = 2. Row 1 says x + y + z = 6, so x = 1. The answer matches the elimination result above.

Carrying on until every leading entry is 1 with zeros above and below gives reduced row echelon form, which is Gauss-Jordan elimination. A third matrix route writes the system as AX = B and computes X = A⁻¹B; it works whenever A is invertible, but computing the inverse by hand takes longer than row reduction. In software such as MATLAB, the backslash operator A\b solves the system directly, which is useful in the engineering labs covered by our MATLAB assignment help.

Special Cases: No Solution and Infinitely Many Solutions

Every method signals the special cases in its own way. Learn the signs so you do not mistake them for arithmetic errors.

No Solution

Solve 2x + 4y = 8 and x + 2y = 3. Multiply the second equation by 2: 2x + 4y = 6. Subtract it from the first: 0 = 2. Both variables vanished and left a false statement, so there is no solution. The lines have the same slope, −1/2, and different intercepts, so they are parallel.

Infinitely Many Solutions

Solve x + 2y = 4 and 3x + 6y = 12. The second equation is exactly 3 times the first. Eliminating gives 0 = 0, which is always true. Every point on the line x + 2y = 4 works, so there are infinitely many solutions. You write them as (4 − 2t, t), where t is any real number.

MethodNo solution looks likeInfinitely many looks like
GraphingParallel linesThe same line drawn twice
Substitution or eliminationA false statement such as 0 = 2A true statement such as 0 = 0
Cramer's ruleD = 0 and at least one of Dx, Dy is not zeroD, Dx and Dy all equal 0 (confirm with elimination)
Gaussian eliminationA row [0, 0, 0 | c] with c not zeroA row of all zeros and fewer pivots than variables

Turning a Word Problem into a System

Word problems are where students most often know how to solve a system of equations but not how to build one. Name the unknowns, write one equation per fact, then solve.

Problem. A school play sold 200 tickets. Adult tickets cost 12 dollars and student tickets cost 7 dollars. Ticket sales brought in 2,050 dollars. How many of each type were sold?

  1. Let a be the number of adult tickets and s the number of student tickets.
  2. Count equation: a + s = 200.
  3. Money equation: 12a + 7s = 2,050.
  4. Substitute s = 200 − a: 12a + 7(200 − a) = 2,050, so 5a + 1,400 = 2,050 and a = 130.
  5. Then s = 200 − 130 = 70.
  6. Check: 12(130) + 7(70) = 1,560 + 490 = 2,050.

The school sold 130 adult tickets and 70 student tickets. The same two-equation pattern, one for quantity and one for value, fits mixture, investment and coin problems.

How to Solve Systems of Linear Equations: Choosing a Method

MethodBest whenDrawback
GraphingYou need a picture or an estimateImprecise for fractional answers
SubstitutionA variable has a coefficient of 1 or −1Fractions pile up otherwise
EliminationCoefficients are integers with an easy common multipleGets long beyond three variables
Cramer's ruleA 2 by 2 or 3 by 3 system and you want a formulaFails when D = 0; slow for large systems
Gaussian eliminationThree or more variables, or any system solved by softwareMore bookkeeping by hand

On a timed test, scan the coefficients before you start. A lone x or y points to substitution; matching or opposite coefficients point to elimination. Our tips on how to prepare for a math test cover building that habit.

Mistakes That Cost Points

Instructors who grade a system of equations see the same handful of slips again and again. Most of them are bookkeeping, not misunderstanding.

  • Solving for one variable and stopping. A system asks for every unknown. Finding x = 4 earns partial credit at best until you also report y.
  • Sign errors when subtracting equations. Subtracting 5x − 4y = 12 means subtracting −4y, which adds 4y. Many students prefer to multiply by −1 and add, which avoids the trap.
  • Writing the answer in the wrong order. An ordered pair is (x, y) and a triple is (x, y, z). Reversing them turns a correct solution into a wrong one.
  • Calling 0 = 0 an error. It is a result: the system is dependent. Write "infinitely many solutions" and describe them.
  • Skipping the check. Substituting your answer into each original equation takes seconds and catches nearly every arithmetic slip.

If you remember one thing about how to solve systems of linear equations, make it this: the method is a choice, but the check is not. Any of the five methods above is correct; the answer is right only when it satisfies every equation.

Practice Problems with Answers

  1. x + y = 10 and x − y = 4
  2. y = 3x − 2 and 2x + y = 13
  3. 4x + 3y = −2 and 2x − 5y = 12
  4. 6x − 4y = 10 and 3x − 2y = 5
  5. 2x − y = 3 and 4x − 2y = 9
  6. x + y + z = 4, x − y + z = 0 and 2x + y − z = 3
  7. A café sold 50 drinks, some small at 3 dollars and some large at 5 dollars, for a total of 196 dollars. How many of each were sold?

Answers.

  1. (7, 3). Add the equations: 2x = 14.
  2. (3, 7). Substitute: 2x + 3x − 2 = 13.
  3. (1, −2). Multiply the second equation by 2 and subtract: 13y = −26.
  4. Infinitely many solutions. The first equation is twice the second.
  5. No solution. Doubling the first gives 4x − 2y = 6, which contradicts 4x − 2y = 9.
  6. (1, 2, 1). In this system of equations, subtracting the second equation from the first gives 2y = 4.
  7. 27 small and 23 large. Use s + l = 50 and 3s + 5l = 196.

Once these feel routine, the same ideas return in quadratic systems and in calculus; see our guides to solving quadratic equations and calculus concepts. If a problem set still stalls, a tutor from our math homework help service can work through it with you step by step.

Frequently Asked Questions

What Are the 3 Methods for Solving Systems of Equations?

Most algebra courses teach three methods first: graphing, substitution and elimination. Graphing finds where the lines cross, substitution replaces one variable with an expression from the other equation, and elimination adds or subtracts equations to cancel a variable. Later courses add matrix methods such as Cramer's rule and Gaussian elimination for larger systems.

How Do You Know If a System Has No Solution?

When you solve it algebraically, both variables cancel and you are left with a false statement such as 0 = 5. On a graph, the lines are parallel: they have the same slope but different y-intercepts. In matrix form, a row reduces to all zeros on the left and a nonzero number on the right.

How Do You Know If a System Has Infinitely Many Solutions?

Both variables cancel and you are left with a true statement such as 0 = 0. That happens when one equation is a multiple of the other, so both describe the same line. Write the answer in terms of a parameter, for example (4 minus 2t, t), instead of a single point.

Which Method Is Fastest for Solving a System of Equations?

It depends on the coefficients. If a variable already has a coefficient of 1, substitution is usually quickest. If the coefficients of one variable match or are opposites, elimination is faster. For three or more variables, Gaussian elimination on an augmented matrix is the most organized. Graphing is the slowest when you need exact answers.

Can a System of Linear Equations Have Exactly Two Solutions?

No. Two different straight lines can cross at most once, so a linear system has exactly one solution, none, or infinitely many. If two solutions exist, every point on the line through them is also a solution. Systems that include a curve, such as a line and a parabola, can have two solutions, but those are not linear systems.

When Can You Not Use Cramer's Rule?

Cramer's rule needs a square system, meaning the same number of equations as unknowns, and a coefficient determinant that is not zero. If the determinant is zero, the system has no solution or infinitely many, and Cramer's rule cannot tell you which. Switch to elimination or row reduction to find out.

How Do You Check Your Answer to a System of Equations?

Substitute your values into every original equation, not the rearranged versions you made along the way. If each equation comes out true, the answer is correct. Checking only one equation is a common mistake, because an arithmetic slip can produce values that satisfy one equation but not the other.

Share this post

More Posts Worth Your Time