# how to make a symmetric positive definite matrix given a random matrix A

I am trying to generate a random symmetric positive definite matrix. I'm using Julia and have made a random matrix $$A$$ with it. Through a google search I found an equation $$\frac{1}{2}(A + A') + nI$$, with A being an $$n \times n$$ matrix. How ever I'm not sure why that results in a positive definite matrix, so have to take there word that it does. Also I am worried that the large difference in order of magnitude between the diagonal entries and off diagonal entries when adding $$nI$$ for large $$n$$, will result in Floating point errors later down in the congratulations.

Is there a way to transform a matrix $$A$$ into a new matrix that is symmetric positive definite were all the values are of similar orders of magnitudes? And could you please show that the result will always be symmetric and positive definite?

• How about $AA^T$ ? – Mike Hawk Nov 5 '19 at 15:35

To transform a matrix $$A$$ to a symmetric matrix, you have just to do this $$A=\frac{1}{2}(A+A'),$$ where $$A'$$ is the transpose of $$A$$.
To get a positive definite matrix, calculate $$A+\lambda I$$, where $$\lambda$$ is just greater than the smallest eigenvalue of A.
• @amd The main criteria I know for determining that a matrix is positive definite is it's definition, that a Matrix $A$ is positive definite iff for all non-zero $x \in \mathbb{R}^n$, it is true that $x^T A x >0$. I know that a positive definite matrix has positive eigenvalues. what I don't innately see is why adding the $\lambda I$ guarantees that the matrix is now positive definite. – seafan Nov 5 '19 at 20:26
• @seafan If $Av=\lambda v$, then what does $(A+cI)v$ equal? What does that say about the eigenvalues of $A+cI$? – amd Nov 5 '19 at 20:32