Compute the LU decomposition of
$$
\left(
\begin{matrix}
1 & 2 \\
3 & 4
\end{matrix}
\right).
$$
A little LU Decomposition
Let $A=\begin{pmatrix} 1&2\\3&4\end{pmatrix}$.
Then a lower triangular matrix is $$L=\begin{pmatrix} 1&0\\3&1\end{pmatrix}$$
and an upper triangular matrix is $$U=\begin{pmatrix} 1&2\\0&-2\end{pmatrix}$$.
We can check our answer by solving $A=LU$ $$A=\begin{pmatrix} 1&0\\3&1\end{pmatrix}\begin{pmatrix} 1&2\\0&-2\end{pmatrix}$$ $$=\begin{pmatrix} 1&2\\3&4\end{pmatrix}$$
which is in fact $A$.
@Cheryl What about the pivot matrix $P$?
Doesn't P have to be either \begin{pmatrix} 1&0\\0&1\end{pmatrix} or \begin{pmatrix} 0&1\\ 1&0\end{pmatrix}
Can we count the identity matrix as P or does it HAVE to permutate?
@ctyra Yes, $P$ must be one of those two matrix. More generally, an $n$-dimensional permutation matrix is just an identity matrix with it's rows permuted. The permutation can be any permutation - including the identity permutation, which produces the identity matrix.
Shouldn't we pivot to swap row 1 and row 2 in $A$? That way the row with the largest absolute value in the first column is up top? Or did I completely misunderstand that in class?
Swapping the rows, I got
\[
U=
\begin{bmatrix}
3 & 4 \\
0 & \frac{2}{3}
\end{bmatrix}
\]
\[
L=
\begin{bmatrix}
1 & 0 \\
\frac{1}{3} & 1
\end{bmatrix}
\]
\[
P=
\begin{bmatrix}
0 & 1 \\
1 & 0
\end{bmatrix}
\]
Multiplying all these together gave me correct $A$...