\input{decls.tex}
\title{Linear Algebra}
\begin{document}
\maketitle
\section*{Allowable Operations on a Linear System}
Solutions invariant.
\begin{itemize}
\item Multiply an equation by a non-zero scalar
\item Swap two equations
\item Add a multiple of one equation to another
\end{itemize}
\subsection*{Example}
\begin{align*}
&\systeme{
	x - 2y + 2z = 6,
	-x + 3y + 4z = 2,
	2x + y - 2z = -2
}\\\\
	E_2 & \implies E_2 + E_1 \\
	E_3 & \implies E_3 + E_1 \\
&\systeme{
	x - 2y + 2z = 6,
	y + 6z = 8,
	5y - 6z = -14
}\\\\
	E_3 & \implies E_3 - 5E_2 \\
&\systeme{
	x - 2y + 2z = 6,
	y + 6z = 8,
	z = \frac{3}{2}
}\\\\
	E_1 & \implies E_1 - 2E_3 \\
	E_2 & \implies E_2 - 6E_3 \\
&\systeme{
	x - 2y = 3,
	y = -1,
	z = \frac{3}{2}
}\\\\
	E_1 & \implies E_1 + 2E_2 \\
&\systeme{
	x = 1,
	y = -1,
	z = \frac{3}{2}
}\\\\
\end{align*}
\section*{As Matrices}
\begin{align*}
\systeme{
	x + 2y = 1,
	2x - y = 3
}
\quad=\quad
\begin{pmatrix}[cc|c]
1 & 2 & 1 \\
2 & -1 & 3
\end{pmatrix}
& \systeme{
	x - y + z = -2,
	2x + 3y + z = 7,
	x - 2y - z = -2
} \quad=\quad \begin{pmatrix}[ccc|c]
	1 & -1 & 1  & -2 \\
	2 & 3  & 1  & 7 \\
	1 & -2 & -1 & -2
\end{pmatrix} \\
\grstep[R_3 - R_1]{R_2 - 2R_1} & \begin{pmatrix}[ccc|c]
	1 & -1 & 1  & -2 \\
	0 & 5  & -1 & 11 \\
	0 & -1 & -2 & 0
\end{pmatrix} \\
\grstep{5R_3 + R_2} & \begin{pmatrix}[ccc|c]
	1 & -1 & 1 & -2 \\
	0 & 5 & -1 & 11 \\
	0 & 0 & -11 & 11 \\
\end{pmatrix} \\
\grstep{-11^{-1}R_3} & \begin{pmatrix}[ccc|c]
	1 & -1 & 1 & -2 \\
	0 & 5 & -1 & 11 \\
	0 & 0 & 1 & -1
\end{pmatrix} \\
\grstep[R_1 - R_3]{R_2 + R_3} & \begin{pmatrix}[ccc|c]
	1 & -1 & 0 & -1 \\
	0 & 5 & 0 & 10 \\
	0 & 0 & 1 & -1
\end{pmatrix} \\& 
\grstep{5^{-1}R_2} & \begin{pmatrix}[ccc|c]
	1 & -1 & 0 & -1 \\
	0 & 1 & 0 & 2 \\
	0 & 0 & 1 & -1 \\
\end{pmatrix} \\
\grstep{R_1 + R_2} & \begin{pmatrix}[ccc|c]
	1 & 0 & 0 & 1 \\
	0 & 1 & 0 & 2 \\
	0 & 0 & 1 & -1
\end{pmatrix} \\
= & \quad
\left\{
\subalign{
	x  & ~= ~1 \\
	y  & ~= ~2 \\
	z  & ~= ~-1
}
\right.
\end{align*}
\section*{Row-Echelon Form}
\begin{description}
\item[Row-Echelon Form] The leading entry in each row is 1 and is further to the right than the previous row's leading entry,
all 0 rows are at the end
\item[Reduced Row-Echelon Form] every other entry in a column containing a leading 1 is 0
\item[Theorem:] A matrix can be transformed to reduced row-echelon form using a finite number of allowable row operations
\end{description}
\subsection*{Example}
\begin{align*}
& \systeme{3x_1 + 2x_2 = 1,
         x_1 - x_2 = 4,
		 2x_1 + x_2 = 5} = \begin{pmatrix}[cc|c]
	3 & 2 & 1 \\
	1 & -1 & 4 \\
	2 & 1 & 5
	\end{pmatrix} \\
\grstep{R_1\swap R_2} & \begin{pmatrix}[cc|c]
	1 & -1 & 4 \\
	3 & 2 & 1 \\
	2 & 1 & 5
\end{pmatrix} \\
\grstep[R_2 - 3R_1]{R_3 - 2R_1} & \begin{pmatrix}[cc|c]
	1 & -1 & 4 \\
	0 & 5 & -11 \\
	0 & 3 & -3
\end{pmatrix} \\
\grstep{5^{-1}R_2} & \begin{pmatrix}[cc|c]
	1 & -1 & 4 \\
	0 & 1 & \frac{-11}{5} \\
	0 & 3 & -3
\end{pmatrix} \\
\grstep{R_3 - 2R_2} & \begin{pmatrix}[cc|c]
	1 & -1 & 4 \\
	0 & 1 & \frac{-11}{5} \\
 	0 & 0 & \frac{18}{5}
\end{pmatrix} \\
= & \systeme{
	x_1 - x_2 = 4,
	x_2 = \frac{-11}{5},
	0x_1 + 0x_2 = \frac{18}{5}
}
\end{align*}
\begin{align*}
& \begin{pmatrix}[cccc|c]
1 & -1 & 1 & 1 & 6 \\
-1 & 1 & -2 & 1 & 3 \\
2 & 0 & 1 & 4 & 1 \\
\end{pmatrix} \\
\grstep[R_2 + R_1]{R_3 - 2R_1} & \begin{pmatrix}[cccc|c]
	1 & -1 & 1 & 1 & 6 \\
	0 & 0 & -1 & 2 & 9 \\
	0 & 2 & -1 & 2 & -11
\end{pmatrix} \\
\grstep[R_2\swap R_3]{2^{-1}R_3} & \begin{pmatrix}[cccc|c]
	1 & -1 & 1 & 1 & 6 \\
	0 & 1 & \frac{1}{2} & 1 & \frac{-11}{2} \\
	0 & 0 & -1 & 2 & 9 \\
\end{pmatrix} \\
\grstep[R_1 + R_3]{R_2 - 2^{-1}R_3} & \begin{pmatrix}[cccc|c]
	1 & -1 & 0 & 3 & 15 \\
	0 & 1 & 0 & 0 & -10 \\
	0 & 0 & -1 & 2 & 9 \\
\end{pmatrix} \\
\grstep[-R_3]{R_1 + R_2} & \begin{pmatrix}[cccc|c]
	1 & 0 & 0 & 3  & 15 \\
	0 & 1 & 0 & 0 & -10 \\
	0 & 0 & 1 & -2 & -9 \\
\end{pmatrix} \\
= & \systeme{
	x_1 + 3x_4 = 5,
	x_2 = -10,
	x_3 - 2x_4 = -9
} \\
= & \left\{\substack{
	x_1 = 5 - 3t \\
	x_2 = -10 \\
	x_3 = -9 + 2t
}\right.
\end{align*}
\section*{Determinants}
The determinant of a matrix is defined only for square matrices.
\[\det{A} \neq 0 \iff \exists \text{ a unique solution to the linear system represented by } A\]
Let
\[A = \begin{pmatrix}
	a_{11} & a_{12} & a_{1n} \\
	a_{21} & \ddots & \vdots \\
	a_{31} & \ldots & a_{3n} \\
\end{pmatrix}
\]
\begin{description}
\item[$i, j$ minor of $A$] an $n$x$n$ matrix constructed by removing the $i^\text{th}$ row and $j^\text{th}$ column of $A$ \\
Denoted by $A_{ij}$
\end{description}
\begin{align*}
& \det{A} \text{ where } n = 1. = a_{11} \\
& \det{A} = a_{11}\det{A_{11}} - a_{12}\det{A_{12}} + ... + (-1)^{n+1}a_{1n} \tag{Laplace expansion of the first row} \\
& \qquad \text{or laplace expansion along other row or column}
\text{For } n = 2:&  \\
& \det{A} = a_{11}\cdot a_{22} - a_{12}\cdot a_{21}
\end{align*}
\begin{description}
\item[Upper Triangular] lower left triangle is 0 - $d_{ij} = 0 \quad \forall{i > j}$
\item[Lower Triangular] upper right triangle is 0 - $d_{ij} = 0 \quad \forall{i < j}$
\item[Diagonal] only values on the diagonal - $d_{ij} = 0 \quad \forall{i \neq j}$ \\
$\det{A} = \prod^{N}_{i=0}~a_{ij} \forall~\text{ row-echelon }A$
\end{description}
\begin{itemize}
\item Multiplying a row of a square matrix $A$ by $r$ multiplies $\det{A}$ by $r$
\item Swapping two rows of a square matrix $A$ multiplies $\det{A}$ by $-1$
\item Adding a multiple of a row does not effect the determinant
\end{itemize}
\section*{Transposition}
\begin{description}
\item[$A^T$] $a^T_{ij} = a_{ji}~ \forall~i,j$
\end{description}
Note: $\det{A} = \det{A^T}~\forall~A$
\section*{Matrix Multiplication}
LHS has columns $=$ rows of RHS
It's the cartesian product
\[A\times B = (a_{i1}b_{j1} + a_{i2}b_{2j} + \ldots + a_{im}b_{mj})_{ij}\]
\begin{align*}
	\begin{pmatrix}[c|c|c]
		2 & 1 + 1 & 3 + 6 \\
		4(2) & 4 + 1 & 3(4) + 6 \\
		0 & 2 & 2(6) \\
	\end{pmatrix} = \begin{pmatrix}
		2 & 2 & 9 \\
		8 & 5 & 18 \\
		0 & 2 & 12
	\end{pmatrix}
\end{align*}
\begin{align*}
\begin{pmatrix}1 \\ 2 \\ 3 \end{pmatrix}\begin{pmatrix}1 & 2 & 3 & 4\end{pmatrix} + \begin{pmatrix}
 1 & 2  & 3  & 4 \\
 5 & 6  & 7  & 8 \\
 9 & 10 & 11 & 12 \\
\end{pmatrix}
\end{align*}
\end{document}