Skip to content
  • Open the math solver
  • Ask the AI tutor
  • Find an AP course
  • Create a quiz
  • Open the calculator
  • Graphing Calculator
  • Browse all calculators
  • Read math guides
↑ ↓Enter to open · Esc to close
Solve a problem

Algebra

How to Solve Systems of Equations: Graphing, Substitution and Elimination

By MathSolver Pro Editorial Team · Published

A system of equations asks for values that satisfy every equation at once. Substitution and elimination both work for any linear system; the art is choosing the one that needs less arithmetic.

What a solution to a system means

A system of linear equations is a set of two or more linear equations that share the same unknowns. A solution is an assignment of values, such as x=2x = 2 and y=3y = 3, that makes every equation true simultaneously. Checking a single equation is not enough.

With two unknowns, each equation is a straight line in the plane, and a solution is a point that lies on both lines. That picture explains the three possible outcomes:

  • The lines cross once: exactly one solution.
  • The lines are parallel: no solution. The system is called inconsistent.
  • The lines are the same line: infinitely many solutions. The equations are dependent.
{a1x+b1y=c1a2x+b2y=c2\begin{cases} a_1x + b_1y = c_1 \\ a_2x + b_2y = c_2 \end{cases}

Method 1: graphing

Rewrite each equation in slope-intercept form y=mx+by = mx + b, draw both lines, and read off the intersection. Graphing is the best way to see what a system means, and it immediately shows parallel or identical lines. It is not precise, though: an intersection at x=73x = \frac{7}{3} is hard to read from a sketch. Use it to estimate, then confirm algebraically. You can draw both lines at once in the graphing calculator.

Method 2: substitution

Solve one equation for one variable, substitute that expression into the other equation, and solve the resulting one-variable equation. Substitution is the natural choice when a variable already has a coefficient of 1 or −1-1.

Example: y=2x−1y = 2x - 1 and 3x+y=93x + y = 9

  1. The first equation already gives yy. Substitute it into the second: 3x+(2x−1)=93x + (2x - 1) = 9.
  2. Simplify: 5x−1=95x - 1 = 9, so 5x=105x = 10 and x=2x = 2.
  3. Back-substitute into y=2x−1y = 2x - 1: y=3y = 3.
  4. Check both equations: 3=2(2)−13 = 2(2) - 1 and 3(2)+3=93(2) + 3 = 9. The solution is (2,3)(2, 3).

Always put brackets around the expression you substitute. Writing 3x+2x−13x + 2x - 1 happens to work here, but substituting y=2x−1y = 2x - 1 into 3x−y=93x - y = 9 requires 3x−(2x−1)3x - (2x - 1), and the bracket changes the sign of the −1-1.

Method 3: elimination

Add or subtract multiples of the equations so that one variable cancels. Elimination is usually fastest when both equations are in standard form ax+by=cax + by = c.

Example: 2x+3y=122x + 3y = 12 and 5x−3y=95x - 3y = 9

  1. The yy coefficients are already opposites, so add the equations: 7x=217x = 21, giving x=3x = 3.
  2. Substitute into the first equation: 6+3y=126 + 3y = 12, so y=2y = 2.
  3. Check the second equation: 5(3)−3(2)=15−6=95(3) - 3(2) = 15 - 6 = 9. The solution is (3,2)(3, 2).

When no coefficients match, multiply one or both equations first so that they do.

Example: 3x+2y=163x + 2y = 16 and 4x−5y=−174x - 5y = -17

  1. To eliminate yy, multiply the first equation by 5 and the second by 2: 15x+10y=8015x + 10y = 80 and 8x−10y=−348x - 10y = -34.
  2. Add: 23x=4623x = 46, so x=2x = 2.
  3. Substitute: 3(2)+2y=163(2) + 2y = 16, so 2y=102y = 10 and y=5y = 5.
  4. Check: 4(2)−5(5)=8−25=−174(2) - 5(5) = 8 - 25 = -17. The solution is (2,5)(2, 5).

Spotting no solution or infinitely many

If both variables cancel during elimination, look at what remains.

  • x+y=4x + y = 4 and 2x+2y=102x + 2y = 10. Doubling the first gives 2x+2y=82x + 2y = 8; subtracting leaves 0=20 = 2, which is false. The lines are parallel: no solution.
  • x+y=4x + y = 4 and 3x+3y=123x + 3y = 12. Tripling the first gives exactly the second; subtracting leaves 0=00 = 0. Every point on the line x+y=4x + y = 4 is a solution.

Before you start, you can predict this from the coefficients: if a1a2=b1b2\frac{a_1}{a_2} = \frac{b_1}{b_2}, the lines have equal slopes and the system has either no solution or infinitely many.

Cramer's rule with determinants

For a two-by-two system, determinants give each unknown directly:

x=DxD,y=DyD,D=∣a1b1a2b2∣, Dx=∣c1b1c2b2∣, Dy=∣a1c1a2c2∣x = \frac{D_x}{D},\quad y = \frac{D_y}{D},\quad D = \begin{vmatrix} a_1 & b_1 \\ a_2 & b_2 \end{vmatrix},\ D_x = \begin{vmatrix} c_1 & b_1 \\ c_2 & b_2 \end{vmatrix},\ D_y = \begin{vmatrix} a_1 & c_1 \\ a_2 & c_2 \end{vmatrix}

For 2x+3y=122x + 3y = 12 and 5x−3y=95x - 3y = 9: D=2(−3)−3(5)=−21D = 2(-3) - 3(5) = -21, Dx=12(−3)−3(9)=−63D_x = 12(-3) - 3(9) = -63 and Dy=2(9)−12(5)=−42D_y = 2(9) - 12(5) = -42. So x=3x = 3 and y=2y = 2, matching elimination. If D=0D = 0 the rule does not apply, which is exactly the parallel or identical case. The guide to determinants explains how to compute them for larger systems.

Three equations in three unknowns

The strategy is the same: eliminate one variable from two different pairs of equations to get a two-by-two system, solve it, then back-substitute.

Example: x+y+z=6x + y + z = 6, x−y+z=2x - y + z = 2, 2x+y−z=12x + y - z = 1

  1. Subtract the second equation from the first: 2y=42y = 4, so y=2y = 2.
  2. Substitute y=2y = 2 into the first and third: x+z=4x + z = 4 and 2x−z=−12x - z = -1.
  3. Add these two: 3x=33x = 3, so x=1x = 1, and then z=3z = 3.
  4. Check all three: 1+2+3=61 + 2 + 3 = 6, 1−2+3=21 - 2 + 3 = 2, 2+2−3=12 + 2 - 3 = 1. The solution is (1,2,3)(1, 2, 3).

Larger systems are usually solved with matrices and row reduction; the matrix calculator shows the same process.

A word problem

A theatre sold 40 tickets for 375 dollars. Adult tickets cost 12 dollars and child tickets 7 dollars. How many of each were sold?

  1. Let aa be adult tickets and cc child tickets. Count: a+c=40a + c = 40. Money: 12a+7c=37512a + 7c = 375.
  2. Substitute c=40−ac = 40 - a: 12a+7(40−a)=37512a + 7(40 - a) = 375, so 5a+280=3755a + 280 = 375.
  3. Solve: 5a=955a = 95, a=19a = 19, and c=21c = 21.
  4. Check: 19+21=4019 + 21 = 40 and 12(19)+7(21)=228+147=37512(19) + 7(21) = 228 + 147 = 375.

Two unknowns need two independent facts. If a problem gives you only one, it cannot have a unique answer.

Choosing a method and avoiding errors

  • Use substitution when a variable is already isolated or has coefficient 1.
  • Use elimination when the equations are in standard form, especially if coefficients already match or are opposites.
  • Use Cramer's rule for a quick two-by-two answer, or when you need a formula for each unknown.
  • Always check the final pair in both original equations, since an arithmetic slip can produce a point that fits only one of them.

Compare your working with the systems of equations calculator, which shows each elimination or substitution step. If you need a refresher on the single-equation steps used inside every method, see how to solve linear equations.

Which method should you use?

All the methods give the same solution, so choose the one that keeps the arithmetic simplest. Substitution is best when one equation already has a variable on its own, such as y=2x−1y = 2x - 1, or when a variable has a coefficient of 1 or −1-1. Elimination is usually faster when both equations are in standard form ax+by=cax + by = c and no variable is isolated, because it avoids fractions until the very end.

Graphing is useful for seeing the situation: two lines that cross, two parallel lines, or the same line drawn twice. It is less reliable for exact answers unless the intersection has integer coordinates. Cramer's rule and matrix methods suit systems with three or more variables, and they are what calculators and computer software use internally.

For nonlinear systems, such as a line and a parabola, substitution is almost always the right choice. Solving y=x2y = x^2 and y=x+2y = x + 2 gives x2=x+2x^2 = x + 2, so x2−x−2=0x^2 - x - 2 = 0 and (x−2)(x+1)=0(x - 2)(x + 1) = 0. The intersection points are (2,4)(2, 4) and (−1,1)(-1, 1), and both satisfy each equation.

Checking a solution

A solution of a system must satisfy every equation, not just the one you used last. Substitute your values into each original equation. For the second elimination example, (2,5)(2, 5) gives 3(2)+2(5)=163(2) + 2(5) = 16 and 4(2)−5(5)=−174(2) - 5(5) = -17, so both equations hold. A value that satisfies one equation but not the other points to an arithmetic slip during elimination.

Write the check on your paper. It costs less than a minute and examiners frequently award credit for a verified answer.

The systems of equations calculator solves two and three variable systems with each step shown, which is a convenient way to compare your working.

Frequently asked questions

Do substitution and elimination always give the same answer?

Yes. They are different routes to the same solution set. If they disagree, there is an arithmetic error in one of them, and checking in the original equations will find it.

How many solutions can a linear system have?

Exactly one, none, or infinitely many. A linear system can never have exactly two solutions, because two distinct lines meet at most once.

What does 0 = 0 mean in elimination?

It means one equation is a multiple of the other, so they describe the same line and there are infinitely many solutions. Write the answer as the set of points satisfying either equation.

Can I use elimination with three variables?

Yes. Eliminate the same variable from two different pairs of equations to reduce the problem to two equations in two unknowns, then continue as usual.

How do I know if a system has infinitely many solutions?

If elimination or substitution reduces the system to a statement that is always true, such as 0=00 = 0, the equations describe the same line and every point on it is a solution. If you reach a false statement, such as 0=70 = 7, the lines are parallel and there is no solution.

Can a system have exactly two solutions?

A system of two linear equations cannot: it has zero, one or infinitely many solutions. Nonlinear systems can, as the line and parabola example in this guide shows with its two intersection points.

MathSolver Pro Editorial Team

Math content and review

Our editorial team writes every guide to explain the reasoning behind each method, not just the answer. Each worked example is checked against the site's own solver engines and automated tests before it is published, and articles are revised whenever a method or an exam format changes.