Solution (source code)

= Solution

Suppose an <invertible matrix> has two <LU factorizations>, $A=L_1U_1=L_2U_2$, with $L_1,L_2$ <unit lower triangular matrices> and $U_1,U_2$ <upper triangular matrices>. All four factors are <invertible matrices>, since their square products are invertible. Multiplication by the appropriate <inverse matrices> gives
$$
L_2^{-1}L_1=U_2U_1^{-1}.
$$
By the supplied closure properties, the left side is a <unit lower triangular matrix> and the right side is an <upper triangular matrix>. A <matrix> of both types is diagonal; its diagonal entries are all one. Thus both sides are the <identity matrix>, whence
$$
\boxed{L_1=L_2,\qquad U_1=U_2.}
$$
\b[Qualification of the printed wording:] this establishes uniqueness \b[if the specified <LU factorization> exists]. Invertibility alone does not guarantee an unpivoted <LU factorization>. For example $\begin{pmatrix}0&1\\1&0\end{pmatrix}$ is invertible, but in a product $\begin{pmatrix}1&0\\\ell&1\end{pmatrix}\begin{pmatrix}u_{11}&u_{12}\\0&u_{22}\end{pmatrix}$, the zero top-left entry forces $u_{11}=0$, making the bottom-left entry $\ell u_{11}=0$ as well, contrary to the required value one. A <permutation matrix> is needed in general, as in <PLU factorization>.