[Math] Converting a matrix to the nearest positive definite matrix

matricesmatrix decompositionmatrix-calculus

I have a matrix
$A = \begin{bmatrix}
634.156 & 0 & 755912.06 \\
0 & 1426.8604 & 598151.25\\
755912.06 & 598151.25 & 1.1517e9\\
\end{bmatrix}
$ with eigenvalues
$\begin{bmatrix}
1.15179e9\\
1254.2858\\
-1.52588e-5\\
\end{bmatrix}$. I want to calculate the Cholesky decomposition of the matrix A but A is not positive definite (the last eigenvalue of A is negative). How can I transform A into a nearest positive definite matrix inorder to calculate the Cholesky decomposition?

Best Answer

@ Muhammad Omer , if $A$ is your exact result (and not an approximation), then I think that your work is not serious for the following reasons:

  1. The $a_{i,j}$ are known with $8,6$ or $5$ significant digits ; moreover the most important entry (considering the precision) is $a_{3,3}$ that is known with only $5$ digits.

  2. The $<0$ eigenvalue of $A$ is $\approx -0.06$.

  3. Since you know that the matrix is (in reality) SPD, then the principal question is: after a small modification of $A$, what will be the number of significant digits of the result $C$ s.t. $A=CC^T$ ?

For instance, if we replace $a_{3,3}$ with $1.151795$, then the $<0$ eigenvalue becomes $\approx 2.10^{-4}$. In other words, the digit $7$ is false and must be replaced with $8$ ; therefore, you have only $4$ significant digits. With this modified $A$ ($a_{3,3}=1.151795$), we obtain a matrix $C$ that can be written (with $10$ significant digits) $\begin{pmatrix}25.18245421& 0& 0\\0& 37.77380574& 0\\30017.41029& 15835.08038& 17.58435679\end{pmatrix}$ ; note that $||CC^T-A||\approx 0.37$, that implies that, if we keep $4$ digits for $C$, then the error will be huge (cf. the Steven post: " later computations might be numerically unstable, which may not have the desired effects.").

Conclusion: in my opinion, $C$ is known with $0$ significant digit.