# Is the entrywise nonnegative part of a real positive semidefinite matrix still positive semidefinite?

Let M be a real positive semidefinte matrix and consider the entrywise nonnegative matrix M' obtained from from M by zeroing out all the negative entries of M. Is it true that M' is always positive semidefinite?

Addendum 1: More generally, consider the entrywise nonnegative matrix M'' obtained from M by zeroing out an arbitrary set of off-diagonal entries (symmetrically, of course). Is it true that M'' is always positive semidefinite?

Addendum 2: Thanks to @orangeskid and @user1551 for prompt answers. The question of Addendum 1 has a counterexample even in 3 dimensions.

I will tell you why I thought the answer is no, then I will tell you how to find a counterexample.

1. There is a related question about positive semidefinite matrices, whether taking the absolute value entrywise keeps us in the positive-semidefinite domain. The answer is: only if the dimension is not larger than $3$. Now, if this one were true, the answer to your question would also be Yes. So we suspect the answer to be no.

2. How to look for counterexamples. I found one of size $5\times 5$. The trick is to produce a large enough supply of positive semidefinite matrices. This you do by first producing random symmetric matrices ( $b = a + a^{t}$), then taking the exponential. Eventually you will hit a counterexample.

3. An explicit counterexample

\begin{eqnarray} \left( \begin{array}{ccccc} 189.79 & 5.37843 & -122.669 & -214.584 & 122.596 \\ 5.37843 & 17.4416 & 3.21858 & -20.9122 & 13.1482 \\ -122.669 & 3.21858 & 83.255 & 133.105 & -75.7694 \\ -214.584 & -20.9122 & 133.105 & 255.536 & -146.986 \\ 122.596 & 13.1482 & -75.7694 & -146.986 & 84.6935 \\ \end{array} \right) \end{eqnarray}

• @user1551: You gave a counterexample to the related question for $n=4$, so now you want to know why it's still true for $n=3$. That is easy to prove, may assume the diagonal entries $1$, the determinant needs to stay positive, but the det is $1 + 2 x y z - (x^2 + y^2 + z^2)$, pretty clear now. – orangeskid Aug 24 '15 at 8:13
• @user1551: Ah, OK, just found the exact source, Positive Definite Matrices by Bhatia, page 26. – orangeskid Aug 24 '15 at 8:24

The answer to your first question is no. Here is a random counterexample: $$A = \pmatrix{ 6&2&-1&1\\ 2&1&0&1\\ -1&0&7&2\\ 1&1&2&2}, \ B=\pmatrix{6&2&0&1\\ 2&1&0&1\\ 0&0&7&2\\ 1&1&2&2}.$$ One can verify by Sylvester's criterion that $A$ is positive definite, but $\det B=-1$.

For $2\times2$ matrices, the answer to your question is clearly yes. When the size is $3\times3$, however, I am unable to find any counterexample by computer simulation.