Learn Without Walls

Lesson 2: Matrices and Systems of Equations

← Previous: Substitution and Elimination Module 5 Home Next: Determinants and Cramer's Rule →

Learning Objectives

By the end of this lesson, you will be able to:

Introduction: Why Matrices?

In the previous lesson, we learned substitution and elimination methods for solving systems of equations. While these methods work well for small systems (2 or 3 equations), they become increasingly tedious for larger systems.

Matrices provide a systematic, organized way to solve systems of any size. By representing systems as rectangular arrays of numbers and applying standardized row operations, we can solve complex systems efficiently and reliably.

Advantages of Matrix Methods:

  • Organization: All information is in one compact structure
  • Systematic: Follow clear, repeatable steps
  • Scalability: Works equally well for 2, 3, or 10+ variables
  • Computer-friendly: Easy to program and automate
  • Error reduction: Structured approach minimizes mistakes

This lesson introduces matrix notation and two powerful methods: Gaussian elimination (which finds row-echelon form) and Gauss-Jordan elimination (which finds reduced row-echelon form).

Section 1: Matrix Notation and Augmented Matrices

Matrix: A rectangular array of numbers arranged in rows and columns, enclosed in brackets.
Dimensions: A matrix with m rows and n columns is an m × n matrix (read "m by n").

For systems of linear equations, we use augmented matrices. An augmented matrix contains the coefficients of all variables plus the constants from the right side of the equations, separated by a vertical line.

System of Equations:

ax + by = e
cx + dy = f

Augmented Matrix:

[
abe
cdf
]

Example 1: Write System as Augmented Matrix (2×2)

Problem: Write the system as an augmented matrix:

3x + 2y = 8
x - 4y = -10

Solution:

Identify coefficients and constants:

  • First equation: a = 3, b = 2, constant = 8
  • Second equation: a = 1, b = -4, constant = -10

Augmented matrix:

[ 3 2 | 8 ]
[ 1 -4 | -10]

This is a 2×3 augmented matrix (2 rows, 3 columns including the constants).

Example 2: Write System as Augmented Matrix (2×3)

Problem: Write the system as an augmented matrix:

2x + 3y - z = 5
x - y + 2z = 1

Solution:

This is a system of 2 equations with 3 variables. The augmented matrix is:

[ 2 3 -1 | 5]
[ 1 -1 2 | 1]

This is a 2×4 augmented matrix.

Example 3: Read System from Augmented Matrix

Problem: Write the system of equations represented by this augmented matrix:

[ 1 5 | -3]
[-2 1 | 7]

Solution:

First row represents: 1x + 5y = -3, or simply x + 5y = -3

Second row represents: -2x + 1y = 7, or -2x + y = 7

System:

x + 5y = -3
-2x + y = 7

Example 4: Write 3×3 System as Augmented Matrix

Problem: Write the system as an augmented matrix:

x + 2y - z = 4
3x - y + 2z = 1
2x + y + z = 3

Solution:

[ 1 2 -1 | 4]
[ 3 -1 2 | 1]
[ 2 1 1 | 3]

This is a 3×4 augmented matrix (3 equations, 3 variables).

Important: When writing augmented matrices, ensure all equations are in standard form (variables on left, constant on right) and variables appear in the same order in every equation. If a variable is missing from an equation, use a coefficient of 0.

Section 2: Elementary Row Operations

To solve systems using matrices, we perform elementary row operations. These operations transform the matrix while preserving the solution to the system.

Three Elementary Row Operations:
  1. Swap two rows: R₁ ↔ R₂
  2. Multiply a row by a nonzero constant: kR₁ → R₁
  3. Add a multiple of one row to another row: R₁ + kR₂ → R₁

Row Operation Notation:

  • R₁, R₂, R₃ represent Row 1, Row 2, Row 3
  • R₁ ↔ R₂ means "swap Row 1 and Row 2"
  • 3R₁ → R₁ means "multiply Row 1 by 3 and replace Row 1 with the result"
  • R₂ - 2R₁ → R₂ means "subtract 2 times Row 1 from Row 2 and replace Row 2"

Example 5: Swap Two Rows

Problem: Perform the operation R₁ ↔ R₂ on the matrix:

[ 2 3 | 5]
[ 1 -1 | 2]

Solution:

Simply swap the two rows:

[ 1 -1 | 2]
[ 2 3 | 5]

Why we do this: It's often helpful to have a 1 in the top-left position to simplify calculations.

Example 6: Multiply a Row by a Constant

Problem: Perform the operation (1/2)R₁ → R₁ on the matrix:

[ 2 4 | 6]
[ 1 -3 | 5]

Solution:

Multiply every entry in Row 1 by 1/2:

  • 2 · (1/2) = 1
  • 4 · (1/2) = 2
  • 6 · (1/2) = 3

Result:

[ 1 2 | 3]
[ 1 -3 | 5]

Example 7: Add a Multiple of One Row to Another

Problem: Perform the operation R₂ - 2R₁ → R₂ on the matrix:

[ 1 3 | 5]
[ 2 7 | 12]

Solution:

Step 1: Calculate 2R₁ (multiply Row 1 by 2):

2R₁ = [2, 6, 10]

Step 2: Subtract from Row 2:

R₂ - 2R₁ = [2 - 2, 7 - 6, 12 - 10] = [0, 1, 2]

Result:

[ 1 3 | 5]
[ 0 1 | 2]

Notice: We created a 0 below the leading entry in Row 1!

Example 8: Multiple Row Operations in Sequence

Problem: Perform these operations in order on the matrix:

[ 3 6 | 9]
[ 2 5 | 8]

Operations: (1) (1/3)R₁ → R₁, then (2) R₂ - 2R₁ → R₂

Solution:

After operation (1): Multiply Row 1 by 1/3:

[ 1 2 | 3]
[ 2 5 | 8]

After operation (2): R₂ - 2R₁ → R₂:

2R₁ = [2, 4, 6]
R₂ - 2R₁ = [2-2, 5-4, 8-6] = [0, 1, 2]

Final result:

[ 1 2 | 3]
[ 0 1 | 2]

Example 9: Creating Zeros Below the Diagonal

Problem: Use row operations to get a zero in the (2,1) position:

[ 1 -2 | 3]
[ 4 5 | 7]

Solution:

We want to eliminate the 4 in position (2,1). Use R₂ - 4R₁ → R₂:

4R₁ = [4, -8, 12]
R₂ - 4R₁ = [4-4, 5-(-8), 7-12] = [0, 13, -5]

Result:

[ 1 -2 | 3]
[ 0 13 | -5]

Section 3: Row-Echelon Form and Gaussian Elimination

Row-Echelon Form (REF): A matrix is in row-echelon form if:
  1. All rows consisting entirely of zeros are at the bottom
  2. The first nonzero entry in each row (called the leading entry or pivot) is 1
  3. Each leading 1 is to the right of the leading 1 in the row above it
  4. All entries below a leading 1 are zeros

Row-Echelon Form Pattern (3×3 example):

[ 1 * * | *]
[ 0 1 * | *]
[ 0 0 1 | *]

Where * can be any number. Notice the "staircase" pattern of leading 1s.

Gaussian Elimination: The process of using elementary row operations to transform a matrix into row-echelon form, then using back-substitution to find the solution.

Example 10: Gaussian Elimination on a 2×2 System

Problem: Solve using Gaussian elimination:

x + 2y = 5
3x + 7y = 16

Solution:

Step 1: Write augmented matrix:

[ 1 2 | 5]
[ 3 7 | 16]

Step 2: Get zero below leading 1 using R₂ - 3R₁ → R₂:

3R₁ = [3, 6, 15]
R₂ - 3R₁ = [3-3, 7-6, 16-15] = [0, 1, 1]

[ 1 2 | 5]
[ 0 1 | 1]

Matrix is now in row-echelon form!

Step 3: Back-substitution. Read from bottom up:

  • Row 2: y = 1
  • Row 1: x + 2y = 5, so x + 2(1) = 5, thus x = 3

Solution: (3, 1)

Example 11: System with No Solution

Problem: Solve using Gaussian elimination:

2x + 3y = 7
4x + 6y = 10

Solution:

Step 1: Augmented matrix:

[ 2 3 | 7]
[ 4 6 | 10]

Step 2: Get leading 1 in Row 1: (1/2)R₁ → R₁:

[ 1 3/2 | 7/2]
[ 4 6 | 10]

Step 3: Eliminate: R₂ - 4R₁ → R₂:

4R₁ = [4, 6, 14]
R₂ - 4R₁ = [4-4, 6-6, 10-14] = [0, 0, -4]

[ 1 3/2 | 7/2]
[ 0 0 | -4]

Analysis: Row 2 says 0 = -4, which is impossible!

Conclusion: No solution (inconsistent system)

Example 12: System with Infinite Solutions

Problem: Solve using Gaussian elimination:

x - 2y = 3
-2x + 4y = -6

Solution:

Step 1: Augmented matrix:

[ 1 -2 | 3]
[-2 4 | -6]

Step 2: Eliminate: R₂ + 2R₁ → R₂:

2R₁ = [2, -4, 6]
R₂ + 2R₁ = [-2+2, 4-4, -6+6] = [0, 0, 0]

[ 1 -2 | 3]
[ 0 0 | 0]

Analysis: Row 2 says 0 = 0, which is always true (gives no information).

Row 1: x - 2y = 3, so x = 3 + 2y

Solution: x = 3 + 2t, y = t where t is any real number (infinitely many solutions)

Example 13: Gaussian Elimination on 3×3 System (Part 1)

Problem: Use Gaussian elimination to solve:

x + y + z = 6
2x + y - z = 1
x - y + z = 2

Solution:

Step 1: Augmented matrix:

[ 1 1 1 | 6]
[ 2 1 -1 | 1]
[ 1 -1 1 | 2]

Step 2: Get zeros in column 1 below the leading 1:

R₂ - 2R₁ → R₂:

[2-2, 1-2, -1-2, 1-12] = [0, -1, -3, -11]

R₃ - R₁ → R₃:

[1-1, -1-1, 1-1, 2-6] = [0, -2, 0, -4]

[ 1 1 1 | 6]
[ 0 -1 -3 | -11]
[ 0 -2 0 | -4]

(Continued in next example...)

Example 14: Gaussian Elimination on 3×3 System (Part 2)

Continuing from Example 13...

[ 1 1 1 | 6]
[ 0 -1 -3 | -11]
[ 0 -2 0 | -4]

Step 3: Get leading 1 in Row 2: -R₂ → R₂:

[ 1 1 1 | 6]
[ 0 1 3 | 11]
[ 0 -2 0 | -4]

Step 4: Get zero below Row 2's leading 1: R₃ + 2R₂ → R₃:

2R₂ = [0, 2, 6, 22]
R₃ + 2R₂ = [0+0, -2+2, 0+6, -4+22] = [0, 0, 6, 18]

[ 1 1 1 | 6]
[ 0 1 3 | 11]
[ 0 0 6 | 18]

Step 5: Get leading 1 in Row 3: (1/6)R₃ → R₃:

[ 1 1 1 | 6]
[ 0 1 3 | 11]
[ 0 0 1 | 3]

Matrix is now in row-echelon form!

Step 6: Back-substitution:

  • Row 3: z = 3
  • Row 2: y + 3z = 11, so y + 3(3) = 11, thus y = 2
  • Row 1: x + y + z = 6, so x + 2 + 3 = 6, thus x = 1

Solution: (1, 2, 3)

Section 4: Reduced Row-Echelon Form and Gauss-Jordan Elimination

Reduced Row-Echelon Form (RREF): A matrix is in reduced row-echelon form if:
  1. It is in row-echelon form (all conditions from REF)
  2. Each leading 1 is the ONLY nonzero entry in its column (zeros above AND below)

Reduced Row-Echelon Form Pattern (3×3 example):

[ 1 0 0 | *]
[ 0 1 0 | *]
[ 0 0 1 | *]

The solution can be read DIRECTLY from the last column: x = *, y = *, z = *

Gauss-Jordan Elimination: The process of using elementary row operations to transform a matrix into reduced row-echelon form. The solution is then immediately visible without back-substitution.

Example 15: Gauss-Jordan Elimination on 2×2 System

Problem: Solve using Gauss-Jordan elimination:

2x + 3y = 8
x - y = -1

Solution:

Step 1: Augmented matrix:

[ 2 3 | 8]
[ 1 -1 | -1]

Step 2: Get leading 1 in Row 1. First swap rows (easier): R₁ ↔ R₂:

[ 1 -1 | -1]
[ 2 3 | 8]

Step 3: Get zero below: R₂ - 2R₁ → R₂:

[ 1 -1 | -1]
[ 0 5 | 10]

Step 4: Get leading 1 in Row 2: (1/5)R₂ → R₂:

[ 1 -1 | -1]
[ 0 1 | 2]

Step 5: Get zero ABOVE Row 2's leading 1: R₁ + R₂ → R₁:

R₁ + R₂ = [1+0, -1+1, -1+2] = [1, 0, 1]

[ 1 0 | 1]
[ 0 1 | 2]

Matrix is now in RREF!

Read solution directly: x = 1, y = 2

Example 16: Gauss-Jordan on 3×3 System

Problem: Solve using Gauss-Jordan elimination:

x + 2y + z = 8
2x + 5y + 3z = 21
x + y - z = 0

Solution:

Initial augmented matrix:

[ 1 2 1 | 8]
[ 2 5 3 | 21]
[ 1 1 -1 | 0]

Get zeros in column 1 below leading 1:

R₂ - 2R₁ → R₂: [0, 1, 1, 5]

R₃ - R₁ → R₃: [0, -1, -2, -8]

[ 1 2 1 | 8]
[ 0 1 1 | 5]
[ 0 -1 -2 | -8]

Get zero in column 2 below Row 2:

R₃ + R₂ → R₃: [0, 0, -1, -3]

[ 1 2 1 | 8]
[ 0 1 1 | 5]
[ 0 0 -1 | -3]

Get leading 1 in Row 3: -R₃ → R₃:

[ 1 2 1 | 8]
[ 0 1 1 | 5]
[ 0 0 1 | 3]

Now work upward to get zeros ABOVE each leading 1:

R₂ - R₃ → R₂: [0, 1, 0, 2]

R₁ - R₃ → R₁: [1, 2, 0, 5]

[ 1 2 0 | 5]
[ 0 1 0 | 2]
[ 0 0 1 | 3]

Finally, get zero above Row 2's leading 1:

R₁ - 2R₂ → R₁: [1, 0, 0, 1]

[ 1 0 0 | 1]
[ 0 1 0 | 2]
[ 0 0 1 | 3]

Solution (read directly): x = 1, y = 2, z = 3

Example 17: No Solution Identified via RREF

Problem: Use Gauss-Jordan elimination on:

x + y = 2
2x + 2y = 5

Solution:

[ 1 1 | 2]
[ 2 2 | 5]

R₂ - 2R₁ → R₂:

[ 1 1 | 2]
[ 0 0 | 1]

Row 2 says: 0 = 1 (impossible!)

Conclusion: No solution

Example 18: Infinite Solutions with Free Variable

Problem: Use Gauss-Jordan elimination on:

x + 2y - z = 3
2x + 4y - 2z = 6
3x + 6y - 3z = 9

Solution:

[ 1 2 -1 | 3]
[ 2 4 -2 | 6]
[ 3 6 -3 | 9]

R₂ - 2R₁ → R₂: [0, 0, 0, 0]

R₃ - 3R₁ → R₃: [0, 0, 0, 0]

[ 1 2 -1 | 3]
[ 0 0 0 | 0]
[ 0 0 0 | 0]

Analysis: Only one meaningful equation: x + 2y - z = 3

Two free variables. Let y = s and z = t (parameters).

Then x = 3 - 2y + z = 3 - 2s + t

Solution: x = 3 - 2s + t, y = s, z = t (infinitely many solutions)

Example 19: Application - Investment Problem

Problem: Sarah invests a total of $12,000 in three accounts. Account A earns 3% annual interest, Account B earns 4%, and Account C earns 5%. After one year, she earns $510 in interest. The amount in Account C is twice the amount in Account A. How much did she invest in each account?

Solution:

Step 1: Define variables:

  • Let x = amount in Account A
  • Let y = amount in Account B
  • Let z = amount in Account C

Step 2: Write equations:

x + y + z = 12000 (total investment)
0.03x + 0.04y + 0.05z = 510 (interest earned)
z = 2x, or -2x + z = 0 (Account C is twice Account A)

Step 3: Augmented matrix:

[ 1 1 1 | 12000]
[ 0.03 0.04 0.05| 510]
[-2 0 1 | 0]

Step 4: Apply Gauss-Jordan (details omitted for brevity):

After row operations, RREF is:

[ 1 0 0 | 3000]
[ 0 1 0 | 3000]
[ 0 0 1 | 6000]

Solution: x = 3000, y = 3000, z = 6000

Answer: Account A: $3,000, Account B: $3,000, Account C: $6,000

Section 5: Applications of Matrix Methods

Matrix methods are particularly useful for systems with three or more variables, where substitution and elimination become unwieldy. Here are situations where matrices excel:

When to Use Matrix Methods:

  • Large systems: 3+ equations and variables
  • Many systems with same coefficients: Change only the constants
  • Computer solutions: Algorithms are easily programmed
  • Applied problems: Economics, engineering, chemistry, physics

Example 20: Mixture Problem (Three Substances)

Problem: A chemist needs to mix three solutions (A, B, and C) to create 100 liters of a mixture that is 30% acid. Solution A is 20% acid, Solution B is 40% acid, and Solution C is 50% acid. The amount of Solution B must equal the combined amounts of A and C. How many liters of each solution should be used?

Solution:

Variables:

  • x = liters of Solution A
  • y = liters of Solution B
  • z = liters of Solution C

Equations:

x + y + z = 100 (total volume)
0.20x + 0.40y + 0.50z = 0.30(100) = 30 (acid amount)
y = x + z, or -x + y - z = 0 (B equals A plus C)

Augmented matrix:

[ 1 1 1 | 100]
[ 0.20 0.40 0.50| 30]
[-1 1 -1 | 0]

After Gauss-Jordan elimination (steps omitted):

[ 1 0 0 | 20]
[ 0 1 0 | 50]
[ 0 0 1 | 30]

Solution: x = 20, y = 50, z = 30

Answer: 20 L of Solution A, 50 L of Solution B, 30 L of Solution C

Example 21: Traffic Flow Problem

Problem: The diagram shows traffic flowing through a network of one-way streets. The numbers indicate cars per hour entering and leaving each intersection. Find the traffic flow x, y, and z on the unknown streets.

(Assume diagram shows: 100 cars enter intersection A, split to x and 30; at B, x and y merge to 80 leaving; at C, y and z merge to 50 leaving; at D, 30 and z merge to 60 leaving)

Solution:

Traffic conservation principle: Flow in = Flow out at each intersection

Equations:

Intersection A: 100 = x + 30, so x = 70
Intersection B: x + y = 80, so 70 + y = 80, thus y = 10
Intersection D: 30 + z = 60, so z = 30

Verification at C: y + z = 10 + 30 = 40... but problem states 50 leaving.

(Note: In real problems, equations would be consistent. This illustrates the setup method.)

General approach: Write "flow in = flow out" equation for each intersection, then solve the system using matrices.

Example 22: Cost Analysis Problem

Problem: A bakery produces three types of bread: white, wheat, and rye. Each loaf requires flour, yeast, and salt. A white loaf needs 3 cups flour, 1 tsp yeast, and 1 tsp salt. A wheat loaf needs 2 cups flour, 1 tsp yeast, and 2 tsp salt. A rye loaf needs 2 cups flour, 2 tsp yeast, and 1 tsp salt. One day the bakery used 56 cups of flour, 28 tsp of yeast, and 32 tsp of salt. How many loaves of each type were baked?

Solution:

Variables:

  • x = number of white loaves
  • y = number of wheat loaves
  • z = number of rye loaves

Equations (from ingredient usage):

3x + 2y + 2z = 56 (flour)
x + y + 2z = 28 (yeast)
x + 2y + z = 32 (salt)

Augmented matrix:

[ 3 2 2 | 56]
[ 1 1 2 | 28]
[ 1 2 1 | 32]

After Gauss-Jordan elimination:

[ 1 0 0 | 8]
[ 0 1 0 | 12]
[ 0 0 1 | 8]

Solution: x = 8, y = 12, z = 8

Answer: 8 white loaves, 12 wheat loaves, 8 rye loaves

Check Your Understanding

1. Write the following system as an augmented matrix:

5x - 2y = 7
3x + y = 4

[ 5 -2 | 7]
[ 3 1 | 4]

2. Perform the operation R₂ - 3R₁ → R₂ on the matrix:

[ 1 2 | 5]
[ 3 8 | 17]

3R₁ = [3, 6, 15]

R₂ - 3R₁ = [3-3, 8-6, 17-15] = [0, 2, 2]

[ 1 2 | 5]
[ 0 2 | 2]

3. Which of the following matrices is in row-echelon form?

(A) [1 2 | 3]
    [0 1 | 5]

(B) [1 0 | 2]
    [0 0 | 1]

(C) [0 1 | 4]
    [1 0 | 2]

Answer: (A)

(A) has leading 1s in staircase pattern with zeros below - correct REF

(B) has 0 = 1 in Row 2 - represents inconsistent system, not proper REF

(C) has leading 1 in Row 2 to the LEFT of Row 1's leading entry - violates REF

4. Use Gaussian elimination to solve:

x + 3y = 7
2x + 5y = 11

Augmented matrix: [1 3|7], [2 5|11]

R₂ - 2R₁ → R₂: [1 3|7], [0 -1|-3]

-R₂ → R₂: [1 3|7], [0 1|3]

Back-substitution: y = 3, then x + 3(3) = 7, so x = -2

Solution: (-2, 3)

5. Which of the following matrices is in reduced row-echelon form?

(A) [1 2|3]
    [0 1|2]

(B) [1 0|5]
    [0 1|3]

Answer: (B)

(A) is in REF but not RREF - the 2 above the leading 1 in column 2 should be 0

(B) is in RREF - leading 1s have zeros above AND below

6. Use Gauss-Jordan elimination to solve:

x - y = 1
2x + y = 8

[1 -1|1], [2 1|8]

R₂ - 2R₁ → R₂: [1 -1|1], [0 3|6]

(1/3)R₂ → R₂: [1 -1|1], [0 1|2]

R₁ + R₂ → R₁: [1 0|3], [0 1|2]

Solution: x = 3, y = 2

7. What does the following reduced matrix tell you about the system's solution?

[ 1 0 | 4]
[ 0 0 | 3]

Row 2 says: 0 = 3, which is impossible.

The system has NO SOLUTION (inconsistent)

8. Set up (but do not solve) the augmented matrix for this problem:

A store sells three types of juice boxes: apple (x), orange (y), and grape (z). On Monday, they sold 100 total boxes for $180. Apple costs $1.50, orange costs $2.00, and grape costs $1.75. They sold twice as many apple boxes as grape boxes.

Equations:

x + y + z = 100 (total boxes)

1.50x + 2.00y + 1.75z = 180 (total revenue)

x = 2z, or x - 2z = 0 (apple is twice grape)

Augmented matrix:

[ 1 1 1 | 100]
[ 1.5 2 1.75| 180]
[ 1 0 -2 | 0]

Key Takeaways

← Previous: Substitution and Elimination Module 5 Home Next: Determinants and Cramer's Rule →