Scientia sine finibus

Linear Algebra / Unit 2, Systems of Linear Equations / Topic 2.1

Units and Topics

Unit 2. Systems of Linear Equations

2.1 Systems and Elimination

A system of linear equations is a set of equations that must all be true at the same time. This topic shows two pictures of a system, the three possible outcomes, and a method called elimination that solves any system.

You need Topics 1.1 and 1.3 for this topic.

1. What a System Is

Here is a system of two linear equations with two unknowns:

x + 2y = 5 3x − y = 1

A solution is a pair of numbers x and y that makes both equations true. For this system the solution is x = 1 and y = 2, because 1 + 4 = 5 and 3 − 2 = 1.

An equation is called linear when each unknown appears only to the first power and the unknowns are not multiplied by each other. The equation x + 2y = 5 is linear. The equations xy = 5 and x² + y = 5 are not linear.

2. The Row Picture

From Topic 1.3, each linear equation in x and y is a line. The first equation is one line, and the second equation is another line. A solution must be on both lines, so the solution is the point where the two lines cross. This is called the row picture, because each row of the system is one line.

Two lines in a plane can meet in three ways, so a system of two equations has three possible outcomes.

The two linesSolutions
Cross at one pointExactly one solution
Are parallel and differentNo solution
Are the same lineInfinitely many solutions

Try it: two lines

Each line passes through its two round handles. Drag the handles to move the lines. The purple ring marks the solution.

A system with exactly two solutions is not possible. Two different lines cannot cross at two points.

3. The Column Picture

The same system can be read in a second way. Collect the coefficients of x into one vector, the coefficients of y into another vector, and the right sides into a third vector:

x 13 + y 2−1 = 51

This is a linear combination, as in Topic 1.1. The question is now which coefficients x and y make the combination of the two column vectors equal to the target (5, 1). The answer is the same as before: x = 1 and y = 2.

1 13 + 2 2−1 = 1 + 43 − 2multiply each column by its coefficient, then add1 13 + 2 2−1 = 51the target

The row picture asks where two lines cross. The column picture asks how to reach a target with two vectors. They are two views of the same system, and both are used in the rest of the course.

The column picture explains the three outcomes in a new way. If the two column vectors point along different lines, their span is the whole plane, so each target can be reached in exactly one way. If the two column vectors point along the same line, a target on that line can be reached in many ways, and a target off that line cannot be reached.

4. Elimination

Elimination is a method for solving a system. The idea is to combine the equations so that one unknown disappears. Two operations are allowed, because they do not change the solutions:

  • Multiply both sides of an equation by a number that is not zero.
  • Add a multiple of one equation to another equation.

Step by step: elimination

Press Next to see one step at a time.

After elimination, always substitute the solution into both of the original equations. This check takes a few seconds and catches most arithmetic errors.

When elimination shows no solution or many solutions

Consider the system x + 2y = 5 and 2x + 4y = 7. Multiplying the first equation by −2 and adding it to the second equation gives 0 = −3. This statement is false, so the system has no solution. The two lines are parallel.

Now consider x + 2y = 5 and 2x + 4y = 10. The same step gives 0 = 0. This statement is true but gives no information, because the second equation is the first equation multiplied by 2. The two equations are the same line, so the system has infinitely many solutions.

5. Three Unknowns

Elimination works in the same way with more unknowns. Each equation in x, y, and z is a plane, from Topic 1.3, and a solution is a point on all of the planes.

x + y + z = 6 2x − y + z = 3 x + 2y − z = 2

Use the first equation to remove x from the other two equations. The two new equations have only y and z.

−3y − z = −9the second equation minus 2 times the first equationy − 2z = −4the third equation minus the first equationy = 2z − 4solve the new second equation for y−3(2z − 4) − z = −9substitute into the new first equation−7z + 12 = −9collect the termsz = 3subtract 12, then divide by −7y = 2(3) − 4 = 2substitute z = 3x = 6 − 2 − 3 = 1the first original equation, with y = 2 and z = 3

Check:

1 + 2 + 3 = 6the first equation2(1) − 2 + 3 = 3the second equation1 + 2(2) − 3 = 2the third equation

The solution is (1, 2, 3).

Writing only the numbers

During elimination, only the coefficients and the right sides change. The letters x, y, and z do not have to be written at each step. The numbers of the system can be kept in a table, with one row for each equation:

1112−1112−1 with right sides 632

A table of numbers like this is called a matrix. Topic 2.2 uses this table to organize elimination.

Common Mistakes

  • Multiplying only one side of an equation. When an equation is multiplied by a number, the right side must be multiplied as well.
  • Making a sign error when subtracting an equation. Subtract each term, including the right side.
  • Stopping after one unknown is found. A solution needs a value for each unknown.
  • Reading 0 = 0 as “no solution”. The result 0 = 0 means infinitely many solutions. A false result, such as 0 = −3, means no solution.
  • Skipping the check in the original equations.

Summary

TermMeaning
SolutionValues of the unknowns that make all of the equations true
Row pictureEach equation is a line or a plane, and the solution is where they meet
Column pictureThe unknowns are the coefficients of a linear combination that must reach a target
EliminationCombining equations to remove one unknown at a time

Practice

Work each problem on paper first. Then open the answer to check your work.

1. Solve x + y = 7 and x − y = 1.

2x = 8add the two equationsx = 4divide both sides by 2y = 7 − 4 = 3substitute x = 4 into the first equation4 + 3 = 7the check in the first equation4 − 3 = 1the check in the second equation

2. Solve 2x + 3y = 12 and x − 2y = −1.

−2x + 4y = 2multiply the second equation by −27y = 14add this to the first equationy = 2divide both sides by 7x = −1 + 2(2) = 3the second equation, solved for x2(3) + 3(2) = 12the check in the first equation3 − 2(2) = −1the check in the second equation

3. Write the system 2x + 3y = 12 and x − 2y = −1 in the column picture.

x(2, 1) + y(3, −2) = (12, −1). The column vectors hold the coefficients of x and the coefficients of y.

4. How many solutions does the system 3x − 6y = 9 and x − 2y = 3 have?

Infinitely many. The first equation is 3 times the second equation, so both equations describe the same line.

5. How many solutions does the system x + y = 2 and x + y = 5 have?

None. Subtracting the first equation from the second gives 0 = 3, which is false. The lines are parallel.

6. Solve x + y + z = 4, x − y = 0, and z = 2.

z = 2the third equationx + y = 2the first equation with z = 2x = ythe second equation2x = 2substitute y = xx = 1divide both sides by 2y = 1because y = x

The solution is (1, 1, 2).

Python Practice

Step 1. Write the coefficients as a matrix

Python reads the code one line at a time, from the top to the bottom. The equals sign stores the value on its right under the name on its left, and print shows a result. The name np stands for NumPy, the part of Python that works with vectors and matrices.

The system from this topic is x + 2y = 5 and 3x − y = 1. To solve it with Python, write the coefficients as a table with one row for each equation. This table is called a matrix. Each row goes inside its own square brackets, and all of the rows go inside one more pair of square brackets. The coefficient of y in the second equation is −1.

Python

Python prints the two rows on two lines. The first row holds the coefficients of the first equation, and the second row holds the coefficients of the second equation.

Step 2. Solve the system

The right sides of the two equations go into a vector b. The instruction np.linalg.solve solves the system. It needs the matrix and the vector of right sides, in that order, with a comma between them.

Python

The result is [1. 2.], so x = 1 and y = 2. This is the solution that elimination gave in Part 4 of this topic. Python prints the numbers with a period, because it stores the solution as decimal numbers.

Now solve the system 2x + y = 7 and x − 3y = −7. Change the matrix and the vector of right sides in the next box.

Python

Step 3. Check a solution

A solution should be checked in the original equations. Python can read one component of a vector. The first component of x is x[0], and the second component is x[1]. Python starts counting at 0, not at 1.

The code below solves the first system again, and then calculates the left side of each equation.

Python

The results are 5.0 and 1.0. These are the right sides of the two equations, so the solution is correct. If a result is printed as a number such as 0.9999999999999998, that is a very small rounding error, and the value is 1.

Step 4. Solve a system with three unknowns

The same instruction works for more unknowns. The system from Part 5 of this topic is x + y + z = 6, 2x − y + z = 3, and x + 2y − z = 2. The matrix now has three rows, and each row has three numbers. One row has been left as zeros. Replace the zeros with the coefficients of the third equation, and then press Run.

Python

The solution is (1, 2, 3), as in Part 5. If you press Run before you replace the zeros, Python reports the error Singular matrix. The next step explains this error.

Step 5. A system that does not have exactly one solution

The system x + 2y = 5 and 2x + 4y = 7 has no solution, because the two lines are parallel. Press Run to see what Python does with this system.

Python

Python stops and reports the error Singular matrix. The instruction np.linalg.solve works only when the system has exactly one solution. To find out whether a system has no solution or infinitely many solutions, use elimination, as in Part 4.

Quiz

This quiz has 5 questions on this topic. A question asks you either to choose one answer or to type numbers. The page grades your answers and explains each one. A number can be typed as a whole number, a decimal, a fraction such as 1/3, or a calculation such as sqrt(18)/2 or arccos(1/2). The page shows the value of a calculation next to the box. Angles in a calculation are in degrees. The Calculator button under each question opens a calculator. Your answers are saved in your browser, so they are still on the page when you come back to it.

Choose how your answers are checked

1. Which equation is the column form of the system 2x + y = 4, 3x + 5y = 13?

2. Solve the system 2x + y = 4, 3x + 5y = 13.

3. How many solutions does the system x + 2y = 3, 2x + 4y = 6 have?

4. How many solutions does the system x + 2y = 3, 2x + 4y = 7 have?

5. For which value of k does the system x + 2y = 3, 2x + ky = 5 have no solution?

Next: Topic 2.2, Row Reduction