How-to guide

2x2 system of equations: how to solve two equations in two variables

Solve a 2x2 system of equations (two equations, two unknowns) by elimination, substitution, graphing or Cramer’s rule, with examples and practice answers.

8 minutesBy Hira Noor, mathematicianUpdated
Short answerTo solve a 2x2 system of equations (two linear equations in x and y), eliminate one variable: multiply the equations so the coefficients of x or of y are opposites, add them, and solve for the variable that is left. Substitute that value back to find the other one, then check the pair in both original equations. If both variables cancel at once, the system has no solution or infinitely many.

Just need the answer?

Type both equations into the system of equations calculator to get x and y with every step shown. The guide below shows how to solve a 2x2 system by hand four ways, with practice problems at the end.

What is a 2x2 system of equations?

A 2x2 system of equations is two linear equations in two unknowns, each of the form ax+by=cax + by = c. The "2x2" refers to its coefficient matrix: two rows (equations) by two columns (variables). You will also see it called two equations in two unknowns, a two-variable system or a pair of simultaneous equations. A solution is an ordered pair (x, y) that makes both equations true at once.

Each equation is a straight line, so solving the system means finding where the two lines meet. Two lines can cross once, run parallel, or lie on top of each other, which gives the three possible outcomes:

The three outcomes of a 2x2 system of equations
OutcomeWhat the lines doWhat elimination showsDeterminant D = a₁b₂ − a₂b₁
One solution (consistent, independent)Cross at a single point; different slopesEach variable gets a valueNot zero
No solution (inconsistent)Parallel: same slope, different interceptsA false statement such as 0 = 1Zero
Infinitely many solutions (consistent, dependent)The same line: same slope and interceptA true statement such as 0 = 0Zero
Three panels of two lines on axes. Left: two lines crossing at a single marked point, labeled one solution. Middle: two parallel lines that never meet, labeled no solution. Right: two lines drawn on top of each other, labeled infinitely many.
Each equation is a line. The solution set is wherever the two lines meet.

How to solve a 2x2 system by elimination

  1. Line up the equations

    Write both in the form ax + by = c, so the x terms, the y terms and the constants sit in matching columns.

  2. Match one coefficient

    Multiply one or both equations by constants so that the coefficients of one variable are equal in size and opposite in sign. Multiply every term, including the constant.

  3. Add the equations

    The matched variable cancels, leaving one equation in one unknown. Solve it.

  4. Substitute back

    Put the value into either original equation and solve for the other variable.

  5. Check in both equations

    Substitute the pair into each original equation. A solution must satisfy both, not only the one you used to find the second value.

Elimination is also called the addition method or linear combination. The examples below solve one system, 3x+2y=73x + 2y = 7 and 5x−4y=195x - 4y = 19, four different ways, so you can see that every method lands on the same point.

Example 1: elimination

{3x+2y=7(1)5x−4y=19(2)\begin{cases} 3x + 2y = 7 & (1) \\ 5x - 4y = 19 & (2) \end{cases}

The y coefficients are 2 and −4. Multiplying equation (1) by 2 turns it into 6x + 4y = 14, so the y terms are now 4y and −4y and cancel when the equations are added:

(6x+4y)+(5x−4y)=14+19⇒11x=33⇒x=3(6x + 4y) + (5x - 4y) = 14 + 19 \;\Rightarrow\; 11x = 33 \;\Rightarrow\; x = 3

Substitute x = 3 into equation (1): 3(3) + 2y = 7, so 2y = −2 and y = −1.

Check (x, y) = (3, −1) in both equations
EquationSubstituteLeft sideRight sideTrue?
(1) 3x + 2y = 73(3) + 2(−1)77Yes
(2) 5x − 4y = 195(3) − 4(−1)1919Yes

Both hold, so the solution is (x, y) = (3, −1), the point where the two lines cross. Check it in the calculator.

Example 2: substitution

Substitution is quickest when one variable has a coefficient of 1 or −1, but it works for any system. Here no coefficient is 1, so a fraction appears. Solve equation (1) for y, y=7−3x2y = \frac{7 - 3x}{2}, and substitute it into equation (2):

5x−4⋅7−3x2=19⇒5x−2(7−3x)=19⇒11x−14=19⇒x=35x - 4 \cdot \frac{7 - 3x}{2} = 19 \;\Rightarrow\; 5x - 2(7 - 3x) = 19 \;\Rightarrow\; 11x - 14 = 19 \;\Rightarrow\; x = 3

Then y = (7 − 9)/2 = −1, the same answer. For a system such as x−y=1x - y = 1 and 2x+3y=122x + 3y = 12, substitution is cleaner: x = 1 + y, so 2(1 + y) + 3y = 12, which gives y = 2 and x = 3.

Example 3: graphing

Solve each equation for y to get slope-intercept form, y=7−3x2y = \frac{7 - 3x}{2} and y=5x−194y = \frac{5x - 19}{4}, and draw both lines. The first falls with slope −1.5; the second rises with slope 1.25. Different slopes mean they must cross exactly once:

The lines 3x + 2y = 7 and 5x − 4y = 19 cross at (3, −1)
−505−10123456xy3x + 2y = 7, so y = (7 − 3x)/25x − 4y = 19, so y = (5x − 19)/4Solution (3, −1)
The solution of a 2x2 system is the point the two lines share.

Graphing shows the answer at a glance and makes the special cases obvious, but reading a point off a sketch is only exact when the solution lands on whole numbers. Use it to see the answer, and algebra to prove it.

Example 4: Cramer’s rule

For a1x+b1y=c1a_1x + b_1y = c_1 and a2x+b2y=c2a_2x + b_2y = c_2, the 2 × 2 determinant D=a1b2−a2b1D = a_1b_2 - a_2b_1 decides what kind of answer to expect. If D ≠ 0, there is exactly one solution:

x=c1b2−c2b1D,y=a1c2−a2c1Dx = \frac{c_1b_2 - c_2b_1}{D}, \qquad y = \frac{a_1c_2 - a_2c_1}{D}
D=|325−4|=3(−4)−5(2)=−22D = \begin{vmatrix} 3 & 2 \\ 5 & -4 \end{vmatrix} = 3(-4) - 5(2) = -22

Then x = (7(−4) − 19(2))/(−22) = −66/(−22) = 3 and y = (3(19) − 5(7))/(−22) = 22/(−22) = −1. Cramer’s rule is a fast formula for a 2x2 system with integer coefficients, and the only method that gives one variable without finding the other. Check D in the determinant calculator.

Example 5: a word problem

A café sold 40 drinks for 105.Coffeecosts105. Coffee costs 3 and tea costs $2. How many of each were sold?

Let c be the number of coffees and t the number of teas. Each sentence gives one equation, so this is a 2x2 system:

{c+t=40(drinks)3c+2t=105(dollars)\begin{cases} c + t = 40 & \text{(drinks)} \\ 3c + 2t = 105 & \text{(dollars)} \end{cases}

Multiply the first equation by 2 and subtract it from the second: 3c − 2c = 105 − 80, so c = 25, and then t = 15. Check: 25 + 15 = 40 drinks and 3(25) + 2(15) = 75 + 30 = $105. Check it.

No solution or infinitely many

When D = 0, the two lines have the same slope, and elimination removes both variables at once. What is left tells you which case you have:

  • No solution (inconsistent system): x+y=3x + y = 3 and 2x+2y=72x + 2y = 7. Doubling the first gives 2x + 2y = 6, and subtracting it from the second leaves 0 = 1, which is false. The lines are parallel and never meet. Check it.
  • Infinitely many solutions (dependent system): x+y=3x + y = 3 and 2x+2y=62x + 2y = 6. Subtracting twice the first leaves 0 = 0, which is always true. Both equations describe the same line, so every point on it, such as (0, 3) or (1, 2), is a solution. Write the answer as y = 3 − x, or as (t, 3 − t) for any t. Check it.

A 2x2 linear system can never have exactly two solutions: two different lines meet at most once, and if they share two points they are the same line.

Which method should you use?

Four ways to solve a 2x2 system of equations
MethodBest whenWatch out for
EliminationCoefficients are integers and none is 1; the default by handScaling only some terms; sign errors when subtracting
SubstitutionOne variable has a coefficient of 1 or −1, or is already isolated (y = …)Fractions appear quickly otherwise
GraphingYou want to see the answer or the number of solutionsOnly exact when the point lands on the grid
Cramer’s ruleYou need a formula, or only one variable, and D ≠ 0Fails when D = 0; mixing up the numerators

On a Casio or TI-84 calculator

Most scientific and graphing calculators solve a 2x2 system directly. You enter the coefficients row by row, as a, b and c for each equation ax + by = c, so rearrange both equations into that form first.

  • Casio fx-991EX or fx-570EX: press MENU, choose Equation/Func, then Simul Equation and 2 unknowns. Type the six numbers and press = to step through x and y.
  • Casio fx-991CW: open Equation from the HOME screen, choose Simul Equation, then 2 Unknowns.
  • Casio fx-991ES PLUS: press MODE, 5 (EQN), then 1 for anX + bnY = cn.
  • TI-84 Plus: enter both lines in Y= as y = (7 − 3x)/2 and y = (5x − 19)/4, press GRAPH, then 2nd TRACE (CALC), 5: intersect and ENTER three times. Or store the 2 × 3 augmented matrix in [A] and run rref([A]) from the MATRIX MATH menu; the last column holds x and y.

Check it with ScientifiCalc

  • System of equations calculator: opens with the example filled in and returns x and y, the row operations and whether the system is consistent and independent.
  • Determinant calculator: opens with the 2 × 2 coefficient matrix to confirm D = −22 before you use Cramer’s rule.
  • Math solver: enter 3x + 2y = 7, 5x - 4y = 19, separating the equations with a comma, for numbered steps and a check that substitutes the solution back.
  • Graphing calculator: enter y = (7 - 3x)/2 and y = (5x - 19)/4. The Key points panel lists their intersection at (3, −1).

Type a 2x2 system of equations to get x and y with every step shown.

Open the system of equations

Common mistakes

  • Multiplying only some terms. When you scale an equation, every term changes, including the constant: doubling 3x + 2y = 7 gives 6x + 4y = 14, not 6x + 4y = 7.
  • Sign errors when subtracting equations. Subtracting means changing the sign of every term in the second equation. Multiplying by a negative number and then adding is less error-prone.
  • Misaligned columns. Rewrite y = 2x − 5 as −2x + y = −5 before eliminating, so the x terms, y terms and constants line up.
  • Calling 0 = 0 "no solution". A true statement with no variables means infinitely many solutions. Only a false one, such as 0 = 1, means none.
  • Checking only one equation. The value found by back-substitution always satisfies the equation you used. Check the other one too.

Practice problems with answers

Solve each 2x2 system by any method, then open the link to check your answer and the steps in the calculator.

  1. x + y = 10, x − y = 4. Hint: add the equations. Answer: (7, 3). Check
  2. 2x + 3y = 12, x − y = 1. Hint: substitution, with x = 1 + y. Answer: (3, 2). Check
  3. 4x − 3y = 11, 3x + 2y = 4. Hint: multiply by 2 and 3 to cancel y. Answer: (2, −1). Check
  4. y = 2x − 5, y = −x + 7. Hint: set the right sides equal. Answer: (4, 3). Check
  5. 3x − 6y = 9, x − 2y = 4. Answer: no solution; three times the second equation gives 3x − 6y = 12, which contradicts 9. Check
  6. 2x − y = 3, −4x + 2y = −6. Answer: infinitely many, because the second equation is −2 times the first; every point on y = 2x − 3 works. Check

Frequently asked questions

How do you solve a 2x2 system of equations?

Eliminate one variable by adding a multiple of one equation to the other, solve for the remaining variable, substitute back to find the second one, and check the pair in both original equations. Substitution, graphing and Cramer’s rule give the same answer.

Which method is better, elimination or substitution?

Neither is more correct. Substitution is quicker when a variable has coefficient 1 or −1; elimination is usually tidier when all coefficients are larger integers, and it extends naturally to three or more equations.

How many solutions can a 2x2 system have?

Exactly one, none, or infinitely many. Two lines cross once, never meet, or are the same line, so a linear 2x2 system can never have exactly two solutions.

How can I tell in advance if a system has no solution?

Compute a1b2−a2b1a_1b_2 - a_2b_1. If it is 0, the lines are parallel or identical, and comparing the constants tells you which. If it is not 0, there is exactly one solution.

Can you solve for two variables with one equation?

Not uniquely. One linear equation in x and y is a whole line of solutions. You need a second independent equation to pin down a single point.

Can the math solver handle more than two equations?

Yes. It solves linear systems with two to four unknowns. Separate the equations with commas, semicolons or new lines. For three equations, see the 3x3 system guide.

Tools used in this guide

Determinant Calculator

Exact determinants of 2x2 to 6x6 matrices by row reduction or cofactor expansion, with every step.

Step-by-Step Math Solver

Free worked solutions for equations, systems, inequalities, factoring, derivatives, integrals, limits and matrices.

Graphing Calculator

Plot functions, equations, inequalities, parametric and polar curves; find roots and intersections.