Why Cholesky Decomposition is Only Applicable to Positive-Definite Matirx The textbook I uses says that only when matrix $A \in \mathbb{R}^{n\times n}$ is positive-definite the Cholesky decomposition of $A$ is unique but it does not provide any proof.
I did Cholesky decomposition to a positive-semidefinite matrix 
$
A = 
\left(
\begin{smallmatrix}
1&2\\
2&4
\end{smallmatrix}\right)$
and I have the following
$$
A = 
\begin{pmatrix}
1&2\\
2&4
\end{pmatrix}=
\begin{pmatrix}
1&0\\
2&0
\end{pmatrix}
\begin{pmatrix}
1&2\\
0&0
\end{pmatrix}
$$
I do not understand why this decomposition is not unique.
Could anyone figure out what mistake I made. Thank you in advance.
 A: Let's try to compute (all the possible) Cholesky decompositions of a $2 \times 2$ real positive-semidefinite matrix
$$ \begin{pmatrix} d & e \\ e & f \end{pmatrix}. $$
We want 
$$ \begin{pmatrix} a & 0 \\ b & c \end{pmatrix} \begin{pmatrix} a & b \\ 0 & c \end{pmatrix} = \begin{pmatrix} a^2 & ab \\ ab & b^2 + c^2 \end{pmatrix} = \begin{pmatrix} d & e \\ e & f \end{pmatrix}. $$
This forces $a^2 = d$ so $a = \sqrt{d}$. Then we have two cases:


*

*If $d \neq 0$ then $b = \frac{e}{\sqrt{d}}$ and $c = \sqrt{f - \frac{e^2}{d}}$. In this case, the decomposition is unique.

*If $d = 0$ then we can take any $b$ as long as $f - b^2 \geq 0$ and then take $c = \sqrt{f - b^2}$. In this case, unless $f = 0$, the decomposition won't be unique.


Your matrix falls into case $(1$) so indeed in your case the Cholesky decomposition is unique but in general it might not be unique. For an example of case $(2)$ we have,
$$ \begin{pmatrix} 0 & 0 \\ 0 & 4 \end{pmatrix} = \begin{pmatrix} 0 & 0 \\ 2 & 0 \end{pmatrix}  \begin{pmatrix} 0 & 2 \\ 0 & 0 \end{pmatrix} = \begin{pmatrix} 0 & 0 \\ 0 & 2 \end{pmatrix} \begin{pmatrix} 0 & 0 \\ 0 & 2 \end{pmatrix} $$
(the first decomposition corresponds to taking $b = 2$ while the second corresponds to taking $b = 0$ and there are infinitely many other decompositions with $-2 \leq b \leq 2$).
