Continue **reading** Section 2.2 for next class.
Work through recommended homework questions.

**Quiz 2** is this week, and will cover the material until the end of
today's lecture, focusing on the material since the last quiz:
Sections 1.3, 2.1 and part of 2.2.

**Next office hour:** today, 3:00-3:30.

**Help Centers:** Monday-Friday 2:30-6:30 in MC 106.

**Definition:** A **system of linear equations** is a finite set of
linear equations, each with the same variables.
A **solution** to the system is a vector that satisfies *all* of the equations.

**Example:**
$
\begin{aligned}
x + y\ &= 2\\
-x + y\ &= 4
\end{aligned}
$

$[1, 1]$ is not a solution, but $[-1, 3]$ is. Geometrically, this corresponds to finding the intersection of two lines in $\R^2$.

A system is **consistent** if it has one or more solutions,
and **inconsistent** if it has no solutions.
We'll see later that a consistent system always has either one
solution or infinitely many.

We solved it by doing **row operations**, such as replacing $R_2$
with $R_2 - 3 R_1$ or exchanging rows 2 and 3 until we got it
to the form:
$$
\kern-6ex
\begin{aligned}
\ph x - \ph y - \ph z\ &= 2 \\
y + 3 z\ &= 5 \\
5 z\ &= 10
\end{aligned}
\qquad\qquad
\bmat{rrr|r}
1 & -1 & -1 & 2 \\
0 & 1 & 3 & 5 \\
0 & 0 & 5 & 10 \\
\emat
$$
This system is easy to solve, because of its **triangular** structure.
The method is called **back substitution**:
$$
\begin{aligned}
z\ &= 2\\
y\ &= 5 - 3z = 5 - 6 = -1\\
x\ &= 2 + y + z = 2 - 1 + 2 = 3.
\end{aligned}
$$
So the unique solution is $[3, -1, 2]$.
We can **check this** in the original system to see that it works!

**Question:**
Solve the system
$$
\begin{aligned}
2 x + 3 y\ &= 2 \\
x + 2 y\ &= 2
\end{aligned}
$$
geometrically and algebraically.

**Algebraically:** subtracting half of the first equation from the second gives
$$
\begin{aligned}
2 x + 3 y\ &= 2 \\
\frac{1}{2} y\ &= 1
\end{aligned}
$$
Now we apply back substitution.
The second equation gives $y = 2$, and then the first equation gives $x = -2$.
(Check that this satisfies the original equation!)

**Question:**
How many solutions does the system
$$
\begin{aligned}
2 x + 3 y\ &= 2 \\
x + 2 y\ &= 2 \\
x + 4 y\ &= 2
\end{aligned}
$$
have?

If $[x, y]$ satifies all three equations, then it satisfies
the first two, so by our earlier work, $x = -2$ and $y = 2$.
But this does not satisfy the third equation. So there are no
solutions: the system is inconsistent.

Geometrically, this corresponds to three lines which enclose a triangle.

- Any rows that are entirely zero are at the bottom.
- In each nonzero row, the first nonzero entry (called the
**leading entry**) is further to the right than any leading entries above it.

**Example:** These matrices are in row echelon form:
$$
\kern-6ex
\bmat{rrr}
\red{3} & 2 & 0\\
0 & \red{-1} & 2\\
0 & 0 & 0
\emat
\qquad
\bmat{rrr}
\red{3} & 2 & 0\\
0 & \red{-1} & 2\\
0 & 0 & \red{4}
\emat
\qquad
\bmat{rrrrr}
0 & \red{3} & 2 & 0 & 4 \\
0 & 0 & 0 & \red{-1} & 2\\
0 & 0 & 0 & 0 & \red{4}
\emat
$$

**Example:** These matrices are **not** in row echelon form:
$$
\kern-6ex
\bmat{rrr}
{\bf 0} & {\bf 0} & {\bf 0} \\
\red{3} & 2 & 0\\
0 & \red{-1} & 2\\
\emat
\qquad
\bmat{rrr}
\red{3} & 2 & 0\\
0 & \red{-1} & 2\\
0 & {\bf 2} & 4
\emat
\qquad
\bmat{rrrrr}
0 & \red{3} & 2 & 0 & 4 \\
0 & 0 & 0 & \red{-1} & 2\\
0 & 0 & {\bf 2} & 0 & 4
\emat
$$
This terminology makes sense for any matrix, but we will usually apply
it to the augmented matrix of a linear system. The conditions apply
to the entries to the right of the line as well.

**Question:** For a $2 \times 3$ matrix, in what ways can the leading entries
be arranged?

Just as for triangular systems, we can solve systems in row echelon form using back substitution.

**Example:** Solve the system whose augmented matrix is:
$$
\bmat{rrr|r}
\red{3} & 2 & 2 & 0\\
0 & 0 & \red{-1} & 2\\
0 & 0 & 0 & 0
\emat
$$
How many variables? How many equations? Solution on board.

**Example:**
Solve the system whose augmented matrix is:
$$
\bmat{rr|r}
\red{3} & 2 & 0\\
0 & \red{-1} & 2\\
0 & 0 & \red{4}
\emat
$$
How many variables? How many equations?

**Note:** This is the general pattern for an augmented matrix in
row echelon form:

- If one of the rows is zero except for the last entry, then the system is
**inconsistent**. - If this doesn't happen, then the system is
**consistent**.

Here are operations on an augmented matrix that don't change the solution set.
There are called the **elementary row operations**.

We can always use these operations to get a matrix into row echelon form.
- Exchange two rows.
- Multiply a row by a
**nonzero**constant. - Add a multiple of one row to another.

**Example on board:** Reduce the given matrix to row echelon form:
$$
\bmat{rrr}
-2 & 6 & -7 \\
3 & -9 & 10 \\
1 & -3 & 3
\emat
$$
Note that there are many ways to proceed, and the row echelon form is *not* unique.

- Find the leftmost column that is not all zeros.
- If the top entry is zero, exchange rows to make it nonzero.
- (Optional) It may be convenient to scale this row to make the leading entry into a 1, or to exchange rows to get a 1 here.
- Use the leading entry to create zeros below it.
- Cover up the row containing the leading entry, and repeat starting from step (a).

Note that for a random matrix, row reduction will often lead to many awkward fractions. Sometimes, by choosing the appropriate operations, one can avoid some fractions, but sometimes they are inevitable.

**Example:** Here's another example:
$$
\begin{aligned}
\bmat{rrrr}
0 & 4 & 2 & 3 \\
2 & 4 & -2 & 1 \\
-3 & 2 & 2 & 1/2 \\
0 & 0 & 10 & 8
\emat
\xrightarrow{R_1 \leftrightarrow R_2}
&\bmat{rrrr}
\red 2 & \red 4 & \red{-2} & \red 1 \\
\red 0 & \red 4 & \red 2 & \red 3 \\
-3 & 2 & 2 & 1/2 \\
0 & 0 & 10 & 8
\emat \\
\lra{\frac{1}{2}R_1}
\bmat{rrrr}
\red 1 & \red 2 & \red{-1} & \red{1/2} \\
0 & 4 & 2 & 3 \\
-3 & 2 & 2 & 1/2 \\
0 & 0 & 10 & 8
\emat
\lra{R_3 + 3R_1}
&\bmat{rrrr}
\phm 1 & 2 & -1 & 1/2 \\
0 & 4 & 2 & 3 \\
\red 0 & \red 8 & \red{-1} & \red 2 \\
0 & 0 & 10 & 8
\emat \\
\lra{R_3 - 2R_2}
\bmat{rrrr}
\phm 1 & 2 & -1 & 1/2 \\
0 & 4 & 2 & 3 \\
0 & \red 0 & \red{-5} & \red{-4} \\
0 & 0 & 10 & 8
\emat
\lra{R_4 + 2R_3}
&\bmat{rrrr}
\phm 1 & 2 & -1 & 1/2 \\
0 & 4 & 2 & 3 \\
0 & 0 & -5 & -4 \\
0 & 0 & \red 0 & \red 0
\emat \\
\end{aligned}
$$

**Example on board, if time:**
$\bmat{rrr}
2 & 4 & 6 \\
1 & 2 & 4 \\
-3 & -6 & 4
\emat$

**Gaussian elimination:** This means to do row
reduction on the augmented matrix of a linear system until you get to
row echelon form, and then use back substitution to find the solutions.

**Example 2.11 on board:** Solve the system
$$
\begin{aligned}
\ph w - \ph x - y + 2 z \ &= \phm 1 \\
2 w - 2 x - y + 3 z \ &= \phm 3 \\
- w + \ph x - y \phantom{{} + 3 z}\ &= -3
\end{aligned}
$$
We call the variables corresponding to a column with a leading entry the
**leading variables**, and the remaining variables the **free variables**.
We solve for the leading variables in terms of the free variables,
and assign parameters to the free variables.