\documentclass[12pt]{article}

\usepackage{systeme}

\usepackage{amsmath}
\usepackage{amssymb}

\usepackage{xcolor}

%\usepackage[textheight=8.5in, margin=1.6in]{geometry}
\usepackage[total={6in,8in}]{geometry}

\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\tikzstyle{ball} = [circle,shading=ball, ball color=black,
    minimum size=1mm,inner sep=1.3pt]
%\usetikzlibrary{arrows.meta}
%\tikzset{>={Latex[length=2mm,width=1.5mm]}}

%\usepackage{graphicx}

\usepackage{needspace}  % <-- to prevent bad pagebreak over environment titles
% Use:  \Needspace{3\baselineskip} before opening an environment

\usepackage{enumitem}
%\setlist[enumerate]{leftmargin=*}

%\usepackage[colorlinks=true,citecolor=black,linkcolor=black,urlcolor=blue]{hyperref}

\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\sn}{\mathfrak{S}}
\newcommand{\ve}{\varepsilon}
\newcommand{\ips}[2]{\langle{#1}, {#2}\rangle}
\DeclareMathOperator{\tr}{tr}
\DeclareMathOperator{\Span}{\mathrm{Span}}
\DeclareMathOperator{\rk}{\mathrm{rank}}
\DeclareMathOperator{\trace}{\mathrm{tr}}
\DeclareMathOperator{\im}{\mathrm{im}}
\DeclareMathOperator{\Sym}{\mathrm{Sym}}
\DeclareMathOperator{\Hom}{\mathrm{Hom}}
\DeclareMathOperator{\diag}{\mathrm{diag}}
\DeclareMathOperator{\glb}{\mathrm{glb}}
\DeclareMathOperator{\lub}{\mathrm{lub}}

\parskip = 0.05in
\parindent = 0.0in

%\pagestyle{empty}

\begin{document}
\centerline{Math 201 lecture for Wednesday, Week 1}
\bigskip

\centerline{\bf Reduced row echelon form}
\medskip

{\bf Goals for today:}
\begin{itemize}[noitemsep]
  \item Discuss the computation of the reduced row echelon form of a system (or
    matrix).
  \item  If there is an infinite number of solutions to a system, know how to
    describe the solution set in two ways (which we will call ``parametric
    form'' and ``vector form'').
  \item Vocabulary: reduced row echelon form, pivot variables (or pivot columns or
    pivot entries), free variables.
\end{itemize}

{\bf Procedure:}
\begin{enumerate}[noitemsep]
    \item Convert the linear system into an augmented matrix.
    \item Compute the reduced row echelon form of the matrix.
    \item Convert the reduced matrix back into a system of equations.
    \item Solve for the pivot variables.
    \item Express your solution in one of two forms, as described in the
      examples below.
  \end{enumerate}
\medskip

\textbf{Echelon forms}  See our text for the precise definitions of \emph{echelon form}
(Chapter~I,~Definition 1.10) and \emph{reduced row echelon form} (Chapter~III,
Definition~1.3).  The general structure of a matrix in row echelon form is:
\begin{center}
  \begin{tikzpicture}[scale=0.6]
    \draw (0.1,0)--(0,0)--(0,-5)--(0.1,-5);
    \draw (9-0.1,0)--(9,0)--(9,-5)--(9-0.1,-5);
    \draw (0.1,-1)--(2,-1)--(2,-2)--(3,-2)--(3,-3)--(6,-3)--(6,-4)--(8.9,-4);
    \node at (0.5,-0.5) {$\ast$};
    \node at (2+0.5,-1-0.5) {$\ast$};
    \node at (3+0.5,-2-0.5) {$\ast$};
    \node at (6+0.5,-3-0.5) {$\ast$};
    \node at (2,-4) {\Large $0$};
    \node at (13.5,-1) {$\ast = $ nonzero \emph{pivot} entry };
    \node at (13.5,-3) {zeros below ``staircase''};
  \end{tikzpicture}
\end{center}
The general structure of a matrix in \emph{reduced} row echelon form is:
\begin{center}
  \begin{tikzpicture}[scale=0.6]
    \draw (0.1,0)--(0,0)--(0,-5)--(0.1,-5);
    \draw (9-0.1,0)--(9,0)--(9,-5)--(9-0.1,-5);
    \draw (0.1,-1)--(2,-1)--(2,-2)--(3,-2)--(3,-3)--(6,-3)--(6,-4)--(8.9,-4);
    \node at (0.5,-0.5) {$1$};
    \node at (2+0.5,-1-0.5) {$1$};
    \draw (2+0.5,-0.5) ellipse (2mm and 5mm);
    \node at (3+0.5,-2-0.5) {$1$};
    \draw (3+0.5,-1) ellipse (2mm and 9mm);
    \node at (6+0.5,-3-0.5) {$1$};
    \draw (6+0.5,-1.4) ellipse (2mm and 13mm);
    \node at (2,-4) {\Large $0$};
    \node at (12.5,-1) {pivot entries $=1$};
    \node at (13.5,-2.5) {zeros below ``staircase''};
    \node at (13.5,-3.5) {and above pivot entries};
  \end{tikzpicture}
\end{center}



{\bf Example 1.} Find the solutions to the following linear system over
the real numbers:
\[
  \sysdelim..
  \systeme{2x_3+6x_4=0,x_1+2x_2+x_3+3x_4=1,2x_1+4x_2+3x_3+9x_4+x_5=5.}
\]
\smallskip

{\bf Solution:} The associated augmented matrix is
\[
  \left(\begin{array}{ccccc|c}
      0&0&2&6&0&0\\
      1&2&1&3&0&1\\
      2&4&3&9&1&5
  \end{array} \right).
\]
We now use row operations to compute the reduced row echelon form of this
matrix:
\begin{align*}
  &
  \left(\begin{array}{ccccc|c}
      0&0&2&6&0&0\\
      1&2&1&3&0&1\\
      2&4&3&9&1&5
  \end{array} \right)
  \xrightarrow{r_1\leftrightarrow r_2}
  \left(\begin{array}{ccccc|c}
      1&2&1&3&0&1\\
      0&0&2&6&0&0\\
      2&4&3&9&1&5
  \end{array} \right)
  \xrightarrow{r_3\to r_3-2r_1}\\[10pt]
  &
  \left(\begin{array}{ccccc|c}
      1&2&1&3&0&1\\
      0&0&2&6&0&0\\
      0&0&1&3&1&3
  \end{array} \right)
  \xrightarrow{r_2\to\tfrac{1}{2}r_2}
  \left(\begin{array}{ccccc|c}
      1&2&1&3&0&1\\
      0&0&1&3&0&0\\
      0&0&1&3&1&3
  \end{array} \right)
  \xrightarrow[r_3\to r_3-r_2]{r_1\to r_1-r_2}\\[10pt]
  &
  \left(\begin{array}{ccccc|c}
      1&2&0&0&0&1\\
      0&0&1&3&0&0\\
      0&0&0&0&1&3
  \end{array} \right).
\end{align*}
The final matrix is the {\em reduced row echelon form} of the original matrix. (See
our text for the precise definition.)  The first, third, and fifth column are
the {\em pivot columns}, and the leading 1s in these column are called {\em pivots}.

The system of linear equations represented by the reduced echelon form has the
same set of solutions as the original system and is in a much simpler form:
\[
  \sysdelim..
  \systeme{x_1+2x_2=1,x_3+3x_4=0,x_5=3.}
\]
The variables corresponding to the pivots---in this case, $x_1$, $x_3$, and
$x_5$---are called the {\em pivot variables}.  The others---in this
case,~$x_2$ and~$x_4$---are the {\em free variables}.  The free variables can
take on any values, and once we assign values to the free variables, they
determine the values of the pivot variables.  (Since we have two free variables,
the solution set is \emph{two-dimensional} in a sense that will be precisely
defined later in the course.) The solution set is
\[
  \left\{ (x_1,x_2,x_3,x_4,x_5)\in\R^5: x_1+2x_2=1,x_3+3x_4=0,x_5=3 \right\}.
\]

Solving for the pivot variables, we have
\begin{align*}
x_1&= 1-2x_2\\
x_3&= -3x_4\\
x_5&= 3.
\end{align*}

You should know how to express this solution in the following two ways.  The
first involves writing the pivot variables in terms of the free variables:
\[
  \left\{ (1-2x_2,x_2,-3x_4,x_4,3): x_2,x_4\in\R \right\}.
\]
We will call this the \emph{parametric} version of the solution set.
The second way of writing the solution set we will call the
\emph{vector} version.  It looks like this: 
\[
  \left\{ \left(\begin{array}{c}
      1\\0\\0\\0\\3
  \end{array} \right)
  +
  x_2
  \left(\begin{array}{r}
    -2\\1\\0\\0\\0 
  \end{array} \right)
  +
  x_4
  \left(\begin{array}{r}
    0\\0\\-3\\1\\0 
  \end{array} \right)
  :
  x_2,x_4\in\R
\right\}.
\]
Here we are using \emph{column vectors}, and for instance,
\[
  x_2
  \left(\begin{array}{r}
    -2\\1\\0\\0\\0 
  \end{array} \right)
  =
  \left(\begin{array}{c}
    -2x_2\\x_2\\0\\0\\0 
  \end{array} \right)
\]
and we can add column vectors component-wise.  Therefore,
\[
  \left(\begin{array}{c}
      1\\0\\0\\0\\3
  \end{array} \right)
  +
  x_2
  \left(\begin{array}{r}
    -2\\1\\0\\0\\0 
  \end{array} \right)
  +
  x_4
  \left(\begin{array}{r}
    0\\0\\-3\\1\\0 
  \end{array} \right)
  =
  \left(\begin{array}{c}
      1-2x_2\\x_2\\-3x_4\\x_4\\3
  \end{array} \right).
\]
\medskip

{\bf Example 2.}  Suppose the reduced row echelon form for an augmented matrix has
the form
\[
  \left(\begin{array}{rrrrrrr|r}
      0&1&0&1&2&0&1&7\\
      0&0&1&4&-1&0&3&-2\\
      0&0&0&0&0&1&1&3\\
      0&0&0&0&0&0&0&0
  \end{array} \right).
\]
Write the solution set in parametric and vector form.  
\smallskip

{\bf Solution:}  The first step is to convert the augmented matrix as a system
of equations:
\[
  \sysdelim..
  \systeme{x_2+x_4+2x_5+x_7=7,x_3+4x_4-x_5+3x_7=-2,x_6+x_7=3.}
\]
(The last row corresponds to the equation~$0=0$, which we can discard.)
The pivot variables are~$x_2$, $x_3$, and~$x_6$.  The rest are
free variables.  Solving for the pivot variables:
\begin{align*}
  x_2&=7 -x_4-2x_5-x_7\\
  x_3&= -2-4x_4+x_5-3x_7\\
  x_6&= 3-x_7.
\end{align*}

The parametric form for the solutions is
\begin{equation}\label{eqn:01wed1}
    \left\{
      (x_1,\ 7-x_4-2x_5-x_7,\ -2-4x_4+x_5-3x_7,\ x_4,\ x_5,\ 3-x_7,\ x_7):x_4,x_5,x_7\in\R
  \right\},
\end{equation}
and the vector form is
\[
  \left\{ 
    \left(\begin{array}{r}
	0\\7\\-2\\0\\0\\3\\0
    \end{array} \right)
    +x_4
    \left(\begin{array}{r}
	0\\-1\\-4\\1\\0\\0\\0
    \end{array} \right)
    +x_5
    \left(\begin{array}{r}
	0\\-2\\1\\0\\1\\0\\0
    \end{array} \right)
    +x_7
    \left(\begin{array}{r}
	0\\-1\\-3\\0\\0\\-1\\1
    \end{array} \right)
    : x_4,x_5,x_7\in\R
  \right\}.
\]
\textbf{Important:} Note how these two forms of the solutions are related.  For instance,
looking at just the constant terms in~\eqref{eqn:01wed1} gives the first column
vector displayed above.  Looking at just the coefficients of~$x_4$ gives the
second column vector, and so on.  We get one column for the constants and one
column for each of the free variables.
\medskip

The next example illustrates how linear algebra can be used to say something
about non-linear objects.
\smallskip

{\bf Example 3.} Find all parabolas~$f(x)=ax^2+bx+c$ passing through the
points~$(1,4)$ and~$(3,6)$ (determine~$a$,~$b$, and~$c$).
\smallskip

{\bf Solution:}  To pass through~$(1,4)$, we need~$f(1)=4$, i.e., 
\[
  4=a\cdot 1^2+b\cdot 1+c=a+b+c,
\]
and to pass through~$(3,6)$, we need $f(3)=6$, i.e., 
\[
  6=a\cdot 3^2+b\cdot 3+c=9a+3b+c.
\]
So we need to solve the system
\[
  \sysdelim..
  \systeme{a+b+c=1,9a+3b+c=6.}
\]
Apply our algorithm:
\begin{align*}
  &
  \left(\begin{array}{ccc|c}
      1&1&1&4\\
      9&3&1&6
  \end{array} \right)
  \xrightarrow{r_2\to r_2-9r_1}
  \left(\begin{array}{rrr|r}
      1&1&1&4\\
      0&-6&-8&-30
  \end{array} \right)
  \xrightarrow{r_2\to -\tfrac{1}{6}r_2}\\[10pt]
  &
  \left(\begin{array}{ccc|c}
      1&1&1&4\\
      0&1&4/3&5
  \end{array} \right)
  \xrightarrow{r_1\to r_1-r_2}
  \left(\begin{array}{rrr|r}
      1&0&-1/3&-1\\
      0&1&4/3&5
  \end{array} \right).
\end{align*}
The corresponding system is
\[
  \sysdelim..
  \systeme{a-\frac{1}{3}c=-1,b+\frac{4}{3}c=5.}
\]
The solution set is
\[
  \left\{ (-1+\tfrac{1}{3}c,5-\tfrac{4}{3}c,c): c\in\R \right\}
\]
or
\[
  \left\{ 
    \left(\begin{array}{r}
	-1\\5\\0
    \end{array} \right)
    +
    c
    \left(\begin{array}{r}
	1/3\\-4/3\\1
    \end{array} \right)
    :
    c\in\R
  \right\}.
\]
In this way, the set of parabolas passing through the two given points is
parametrized by a
line in~$3$-space.  For each~$c$, we get a corresponding parabola---the graph of
the function
\[
  f(x)=\left(-1+\tfrac{1}{3}c\right)x^2+\left( 5-\tfrac{4}{3}c \right)x+c.
\]
Here is a check that all of these parabolas pass through $(1,4)$ and $(3,6)$:
\begin{align*}
  f(1)&=\left(-1+\tfrac{1}{3}c\right)+\left( 5-\tfrac{4}{3}c \right)+c=4\\
  f(3)&= \left(-1+\tfrac{1}{3}c\right)3^2+\left( 5-\tfrac{4}{3}c \right)3+c=6.
\end{align*}
Here are graphs of a few of these ($c=-1,0,1,2,3,4,5$):
  \begin{center}
    \begin{tikzpicture}[scale=1.2] 
      \begin{axis}[  
	%title style={at={(0.5,0)},anchor=north,yshift=-30}, 
	%title={Solving a system of two linear equations.}, 
	axis lines = middle, 
	axis line style={->}, 
	axis equal image, 
	xtick distance=1,
	ytick distance=1,
	xticklabels={},
	yticklabels={},
	%xmin=-0.4, 
	xmax=6, 
	%ymin=-0.2, 
	%ymax=16, 
	] 
	%\fill[blue] (axis cs: 1,1) circle (2pt);   
	%\fill[draw=black,fill=white] (axis cs:1,0) circle (2pt);   
	\addplot[domain=-0.4:5,thick,blue] {(-4/3)*x^2+(5+4*1/3)*x-1}; 
	\addplot[domain=-0.4:5,thick,orange] {(-1+0/3)*x^2+(5-4*0/3)*x+0}; 
	\addplot[domain=-0.4:5,thick,green] {(-1+1/3)*x^2+(5-4*1/3)*x+1}; 
	\addplot[domain=-0.4:5,thick,red] {(-1+2/3)*x^2+(5-4*2/3)*x+2}; 
	\addplot[domain=-0.4:5,thick,cyan] {(-1+3/3)*x^2+(5-4*3/3)*x+3}; 
	\addplot[domain=-0.4:5,thick,blue] {(-1+4/3)*x^2+(5-4*4/3)*x+4}; 
	\addplot[domain=-0.4:5,thick,orange] {(-1+5/3)*x^2+(5-4*5/3)*x+5}; 
	\node[ball] at (axis cs:1,4) {};
	\node[ball] at (axis cs:3,6) {};
      \end{axis} 
    \end{tikzpicture} 
  \end{center}
\end{document}


