1

\begin{pmatrix} 1&0&0&0&0\\ 0&1&0&0&0\\ 0&0&1&0&0\\ 0&0&0&1&0\\ 0&0&0&0&1\end{pmatrix} is an example. But I don't find another one. There also should be entries other than 0 or 1.

Is there a systematic way to do this?

4 Answers4

5

Take any invertible matrix $A$ (so just about any matrix unless you're unlucky) and compute $A^TA$.

It is easy to check that $(A^TA)^T=A^T(A^T)^T=A^TA$ (symetric), and for all $x$

$x^T(A^TA)x = (x^T A^T)(Ax)= (Ax)^T(Ax) = (Ax) \cdot (Ax) = \|Ax\|^2\geq 0$ (positive).

Plus since $A$ is invertible, this is equal to $0$ if and only if $x=0$. (definite)

Therefore $A^TA$ is symmetric definite positive.

G. H. Faust
  • 1,766
imj
  • 1,430
3

Yes. Choose any 5 strictly positive numbers and form a diagonal matrix $\Lambda$.

Now take any orthogonal $5 \times 5$ matrix $U$, and form the product $A=U \Lambda U^T$. It is straightforward to check that $A>0$ and $A^T = A$.

(Note that for any $A$ satisfying $A>0$ and $A=A^T$, then it can be written in the form $A=U \Lambda U^T$.)

copper.hat
  • 172,524
3

Replace all non-diagonal entries symmetrically and randomly with numbers whose absolute values are smaller than $\frac14$. By Gershgorin circle theorem, all eigenvalues of the result random matrix will fall inside a circle of radius smaller than $1$ centered at $1$. Since the eigenvalues of a real symmetric matrix are real, the eigenvalues will be all positive. i.e. Any random matrix generated in this manner will be positive definite.

achille hui
  • 122,701
  • 1
    this worked for me fastest. thank you, and to all others thank you, too! – colorblind Feb 15 '14 at 17:34
  • Why less than 1/4 and does this work for higher-dimensional matrices? – dtn Dec 19 '21 at 05:49
  • 1
    @dtn For $n \times n$ matrices, replace $\frac14$ by $\frac{1}{n-1}$. The radii of those circles in Gershogrin circle theorem are the sum of the absolute values of the non-diagonal entries in corresponding row) If the magnitude of all non-diagonal entries are strictly less than $\frac1{n-1}$, the radii of the circles will be strictly less than $1$. – achille hui Dec 19 '21 at 07:10
  • Why should the radius be set to 1? It is necessary to extend the radius to the entire positive half-plane, and thus take into account the element lying on the diagonals in the corresponding row of the matrix. – dtn Dec 20 '21 at 08:54
1

Yet another way, particularly useful for generating SPD matrices with constant diagonal entries, is to take $A=\alpha I+B$, where $\alpha > 0$ and $B$ is any symmetric matrix with $\rho(B)=\|B\|<\alpha$ (can be done simply by taking an arbitrary symmetric matrix and scaling it such that the inequality holds).