Solve Systems of Linear Equations with Two Variables
Determine whether an ordered pair is a solution of a system of equations
A linear equation in two variables has infinitely many solutions — its graph is a line, and every point on that line is a solution to the equation. Now we will work with two or more linear equations grouped together, which is known as a system of linear equations.
An example of a system of two linear equations is shown below. A brace shows that the two equations are grouped together to form a system:
A linear equation in two variables, such as , has an infinite number of solutions — its graph is a line, and every point on the line is a solution to the equation. To solve a system of two linear equations, we want to find the values of the variables that are solutions to both equations. In other words, we are looking for the ordered pairs that make both equations true. These are called the solutions of a system of equations.
To determine if an ordered pair is a solution to a system of two equations, we substitute the values of the variables into each equation. If the ordered pair makes both equations true, it is a solution to the system.
Example. Determine whether the ordered pair is a solution to the system : (a) (b) .
(a) Substitute and into both equations.
makes the first equation true but not the second, so it does not make both equations true — it is not a solution to the system.
(b) Substitute and into both equations.
makes both equations true, so it is a solution to the system.
Is a solution to the system ?
Substitute x=0 and y=0 into both equations. The first equation is true, but the second gives 0, not -5.Is a solution to the system ?
Substitute x=-2 and y=2 into both equations and check whether each one is true.Solve a system of linear equations by graphing
The graph of a linear equation is a line, and every point on that line is a solution to the equation. For a system of two equations, we graph two lines on the same coordinate plane. Then we can see all the points that are solutions to each equation — and by finding what the two lines have in common, we find the solution to the system.
Most linear equations in one variable have one solution, but some, called contradictions, have no solutions, and for others, called identities, all numbers are solutions. Similarly, when we solve a system of two linear equations represented by a graph of two lines in the same plane, there are three possible cases.
The lines intersect.
One solution to the system.
The lines are parallel.
No solution to this system.
Both equations give the same line.
Infinitely many solutions.
Each time we demonstrate a new method, we will use it on the same system of linear equations, . At the end of the section you will decide which method was the most convenient way to solve this system.
Example. How to solve a system of equations by graphing. Solve the system by graphing: .
To graph the first line, write in slope–intercept form: , so and . To graph the second line, use its intercepts: passes through and . Graph both lines on the same rectangular coordinate system, then look for where they cross.
The lines intersect at . Since the lines intersect, we identify the point of intersection and check that it is a solution to both equations.
The solution to the system is .
Solve the system by graphing: . Enter the point of intersection as an ordered pair.
From the second equation, x = 5 - y. Substitute into the first equation to find y first, then find x.Solve a system of linear equations by graphing.
- Graph the first equation.
- Graph the second equation on the same rectangular coordinate system.
- Determine whether the lines intersect, are parallel, or are the same line.
- Identify the solution to the system.
- If the lines intersect, identify the point of intersection. Check that it is a solution to both equations. This is the solution to the system.
- If the lines are parallel, the system has no solution.
- If the lines are the same, the system has an infinite number of solutions.
- Check the solution in both equations.
In the next example, we will first rewrite both equations in slope–intercept form, since that makes them quick to graph.
Example. Solve the system by graphing: .
We solve both equations for so we can graph them using their slopes and -intercepts.
The lines intersect at . Check the solution in both equations:
The solution is .
In all the systems of linear equations so far, the lines intersected and the solution was one point. In the next two examples we’ll look at a system that has no solution and at a system that has an infinite number of solutions.
Example. Solve the system by graphing: .
The first equation is already solved for : , . To graph the second equation, solve it for as well: becomes , so , .
The lines are parallel. Since no point is on both lines, there is no ordered pair that makes both equations true. There is no solution to this system.
Solve the system by graphing: . How many solutions does the system have?
Solve the second equation for y and compare its slope and y-intercept to the first equation.Sometimes the equations in a system represent the same line. Since every point on the line makes both equations true, there are infinitely many ordered pairs that make both equations true — there are infinitely many solutions to the system.
Example. Solve the system by graphing: .
The first equation is already solved for : , . If you write the second equation in slope–intercept form, you’ll find it has the same slope and same -intercept.
The lines are the same! Since every point on the line makes both equations true, there are infinitely many ordered pairs that make both equations true. There are infinitely many solutions to this system.
Solve the system by graphing: . How many solutions does the system have?
Solve the second equation for y — if it matches the first equation exactly, the lines are coincident.The systems we’ve graphed so far had at least one solution. A system of equations that has at least one solution is called a consistent system. A system with parallel lines, like the one above, has no solution — we call a system like this inconsistent.
We also categorize the equations in a system as independent or dependent. If two equations are independent, they each have their own set of solutions — intersecting lines and parallel lines are both independent. If two equations are dependent, all the solutions of one equation are also solutions of the other equation; when we graph two dependent equations, we get coincident lines.
| Lines | Intersecting | Parallel | Coincident |
|---|---|---|---|
| Number of solutions | point | No solution | Infinitely many |
| Consistent/inconsistent | Consistent | Inconsistent | Consistent |
| Dependent/independent | Independent | Independent | Dependent |
We can tell which case we’re in without graphing, just by comparing the slopes and intercepts of the two lines. Write each equation in slope–intercept form and compare.
Example. Without graphing, determine the number of solutions and then classify the system of equations: (a) (b) .
(a) The first equation is already in slope–intercept form. Write the second equation in slope–intercept form too:
Since the slopes are the same () and the -intercepts are different ( and ), the lines are parallel. A system of equations whose graphs are parallel lines has no solution and is inconsistent and independent.
(b) Write both equations in slope–intercept form:
Since the slopes are different, the lines intersect. A system of equations whose graphs intersect has one solution and is consistent and independent.
Without graphing, compare the system . Solve the second equation for y. What is its slope?
Subtract 4x from both sides, then divide every term by 2.The system has two lines with the same slope but different y-intercepts. How many solutions does the system have?
Same slope with different intercepts means the lines are parallel — they never meet.Solving systems of linear equations by graphing is a good way to visualize the types of solutions that may result. However, there are many cases where solving a system by graphing is inconvenient or imprecise. If the graphs extend beyond a small grid, graphing the lines may be cumbersome. And if the solutions to the system are not integers, it can be hard to read their values precisely from a graph.
Solve a system of equations by substitution
We will now solve systems of linear equations by the substitution method. We will use the same system we used first for graphing.
We will first solve one of the equations for either or . We can choose either equation and solve for either variable — but we’ll try to make a choice that will keep the work easy. Then we substitute that expression into the other equation. The result is an equation with just one variable — and we know how to solve those! After we find the value of one variable, we substitute that value into one of the original equations and solve for the other variable. Finally, we check our solution and make sure it makes both equations true.
Example. How to solve a system of equations by substitution. Solve the system by substitution: .
| Step | What to do | Result |
|---|---|---|
| 1. Solve one of the equations for either variable. | We’ll solve the first equation for . | becomes |
| 2. Substitute the expression from Step 1 into the other equation. | Replace in the second equation with . | |
| 3. Solve the resulting equation. | Now we have an equation with just one variable. | , so , so |
| 4. Substitute the solution from Step 3 into one of the original equations to find the other variable. | We’ll use the first equation and replace with . | , so , so |
| 5. Write the solution as an ordered pair. | The ordered pair is . | |
| 6. Check that the ordered pair is a solution to both original equations. | Substitute into both equations. |
Both equations are true, so is the solution to the system.
Solve the system by substitution: . Enter the solution as an ordered pair.
Solve the first equation for y, then substitute that expression for y in the second equation.Solve a system of equations by substitution.
- Solve one of the equations for either variable.
- Substitute the expression from Step 1 into the other equation.
- Solve the resulting equation.
- Substitute the solution in Step 3 into one of the original equations to find the other variable.
- Write the solution as an ordered pair.
- Check that the ordered pair is a solution to both original equations.
Be very careful with the signs in the next example.
Example. Solve the system by substitution: .
We need to solve one equation for one variable. We’ll solve the first equation for .
Substitute into to find :
The ordered pair is . Check this pair in both original equations:
Both check out, so the solution is .
Solve the system by substitution: . Enter the solution as an ordered pair.
Solve the first equation for x, since its coefficient is already 1, then substitute into the second equation.Solve a system of equations by elimination
We have solved systems of linear equations by graphing and by substitution. Graphing works well when the coefficients are small and the solution has integer values. Substitution works well when one equation is already solved for a variable, or can easily be solved for one.
The third method for solving systems of linear equations is called elimination. It is based on the Addition Property of Equality, which says that when you add the same quantity to both sides of an equation, you still have equality. We extend that idea: for any expressions , if and , then .
To solve a system of equations by elimination, we start with both equations in standard form. Then we decide which variable will be easiest to eliminate. We want the coefficients of that variable to be opposites, so that adding the equations eliminates it. Notice how that works when we add these two equations together:
The ’s add to zero, and we’re left with one equation in one variable.
Let’s try another one:
This time we don’t see a variable that can be immediately eliminated if we add the equations. But if we multiply the first equation by , we will make the coefficients of opposite. We must multiply every term on both sides of the equation by :
Then rewrite the system of equations:
Now the coefficients of the terms are opposites, so will be eliminated when we add these two equations:
Once we have an equation with just one variable, we solve it, substitute that value into one of the original equations, and solve for the remaining variable — and, as always, check the answer in both original equations.
Example. How to solve a system of equations by elimination. Solve the system by elimination: .
| Step | What to do | Result |
|---|---|---|
| 1. Write both equations in standard form. If any coefficients are fractions, clear them. | Both equations are already in standard form, with no fractions. | |
| 2. Make the coefficients of one variable opposites. Decide which variable to eliminate, then multiply one or both equations so its coefficients become opposites. | We can eliminate by multiplying the first equation by . | |
| 3. Add the equations resulting from Step 2 to eliminate one variable. | Add the ’s, ’s, and constants. | |
| 4. Solve for the remaining variable. | Divide both sides by . | |
| 5. Substitute the solution from Step 4 into one of the original equations, then solve for the other variable. | Substitute into . | |
| 6. Write the solution as an ordered pair. | ||
| 7. Check that the ordered pair is a solution to both original equations. | Substitute into both equations. |
Solve the system by elimination: . Enter the solution as an ordered pair.
The y-coefficients (1 and -3) aren't opposites yet — multiply the first equation by 3 first.Solve a system of equations by elimination.
- Write both equations in standard form. If any coefficients are fractions, clear them.
- Make the coefficients of one variable opposites.
- Decide which variable you will eliminate.
- Multiply one or both equations so that the coefficients of that variable are opposites.
- Add the equations resulting from Step 2 to eliminate one variable.
- Solve for the remaining variable.
- Substitute the solution from Step 4 into one of the original equations. Then solve for the other variable.
- Write the solution as an ordered pair.
- Check that the ordered pair is a solution to both original equations.
Example. Solve the system by elimination: .
Neither variable can be eliminated by multiplying just one equation. To make the -coefficients opposite, multiply the first equation by and the second by :
Adding these equations eliminates :
So . Substituting into gives , so . The solution is .
Solve the system by elimination: . Enter the solution as an ordered pair.
Multiply the first equation by 3 and the second by 4 so the y-coefficients become opposites.When a system has fractions, clear them first by multiplying each equation by its LCD — then eliminate as usual.
Example. Solve the system by elimination: .
To clear the fractions, multiply each equation by its LCD:
To eliminate , multiply the first equation by :
Substitute into to find : , so , and . The ordered pair is . Check it in both original equations — both are true, so the solution is .
Solve the system by elimination: . Enter the solution as an ordered pair.
Multiply the first equation by 6 and the second by 4 to clear the fractions first.Not every system has exactly one solution. Recall from graphing that two equations describing the same line have infinitely many solutions (a consistent, dependent system), and two equations describing parallel lines have no solution at all (an inconsistent system). Elimination reveals both cases too: if the equation at the end of elimination is a true statement, the system is consistent but dependent and has infinitely many solutions; if it’s a false statement, the system is inconsistent and has no solution.
Example. Solve the system by elimination: .
Write the second equation in standard form: ; multiplying by clears the fraction: — the very same equation as the first! Multiplying this equation by and adding it to the first equation gives , a true statement. The system is consistent but dependent: the two equations describe the same (coincident) line, so the system has infinitely many solutions.
Solve the system by elimination: . How many solutions does the system have?
Rewrite the second equation in standard form and compare it to the first equation.Choose the most convenient method to solve a system of linear equations
When you solve a system of linear equations in an application, you will not be told which method to use. You will need to make that decision yourself, so it helps to recognize which method is easiest for a given system.
| Graphing | Substitution | Elimination |
|---|---|---|
| Use when you need a picture of the situation. | Use when one equation is already solved for one variable, or can easily be solved for one. | Use when the equations are already in standard form. |
Example. For each system of linear equations, decide whether it would be more convenient to solve it by substitution or elimination: (a) (b) .
(a) Since both equations are already in standard form, using elimination will be most convenient.
(b) Since one equation is already solved for , using substitution will be most convenient.
For the system , both equations are in standard form. Which method is more convenient?
Neither equation is already solved for a variable, but both are ready to add once the coefficients are matched.For the system , one equation is already solved for x. Which method is more convenient?
A variable that is already isolated can be substituted directly into the other equation.Key terms
system of linear equations — two or more linear equations grouped together. solution of a system of equations — an ordered pair that makes all the equations in the system true. coincident lines — lines with the same slope and the same -intercept; they graph as a single line. consistent system — a system of equations with at least one solution. inconsistent system — a system of equations with no solution. independent equations — two equations with different solutions (intersecting or parallel lines). dependent equations — two equations whose solutions are identical (coincident lines). substitution method — solving one equation of a system for a variable, then replacing that variable with the resulting expression in the other equation. elimination method — adding two equations (after multiplying by constants if necessary) so that one variable cancels out.
This section is adapted from Intermediate Algebra 2e, Section 4.1: Solve Systems of Linear Equations with Two Variables by Lynn Marecek, MaryAnne Anthony-Smith, and Andrea Honeycutt Mathis, © OpenStax, licensed under CC BY-NC-SA 4.0. Access the original for free at openstax.org. Changes: recreated the coordinate-plane figures (the intersecting/parallel/ coincident overview and the four worked graphing examples) as accessible interactive graphs; recast the multi-step “How To” examples as step tables and equation-alignment arrays; omitted the Be Prepared quiz, Self Check checklist, and end-of-section exercises; and converted the Try Its into interactive exercises with instant feedback — reducing (a)/(b) sub-parts to a single representative exercise, and turning ordered-pair-check, classification, and choose-the-method questions into multiple choice, since a yes/no or word answer of that kind cannot be graded as a math expression.