# The positive semi-definiteness of the element-wise matrix product

I understand that if two matrices are PSD, then the element-wise product of the two matrices is also PSD. However if a matrix in the form $$K = A \odot B$$ is PSD for any PSD matrix $$A$$. How about $$B$$? Must it be PSD? How to prove it?

I am thinking about the following proof.

Since $$A \odot B$$ is PSD, we have:

for any column real vector $$\mathbf{x}$$, $$\mathbf{x}^T(A \odot B)\mathbf{x} \geq 0$$.

That is, trace($$\mathbf{x}^T(A \odot B)\mathbf{x}$$)$$\geq 0$$ $$\implies$$ trace($$A*diag(\mathbf{x}^T)*B*diag(\mathbf{x})$$)$$\geq 0$$.

As A is PSD, we decompose it as $$A = LL^T$$. Then we have:

trace($$L^T*diag(\mathbf{x}^T)*B*diag(\mathbf{x})*L$$)$$\geq 0$$.

Then, for any column real vector $$\mathbf{y}$$,

$$\mathbf{y}^T*$$trace($$L^T*diag(\mathbf{x}^T)*B*diag(\mathbf{x})*L$$)$$*\mathbf{y}\geq 0$$.

$$\implies$$ $$\mathbf{y}^T*L^T*diag(\mathbf{x}^T)*B*diag(\mathbf{x})*L*\mathbf{y} \geq 0$$.

If we can show $$\mathbf{y}^T*L^T*diag(\mathbf{x}^T)$$ can represent any real vector, then we can prove $$B$$ is PSD.

The problem is how to prove $$\mathbf{y}^T*L^T*diag(\mathbf{x}^T)$$ can represent any real vector.

Thanks!

Let $$A$$ be a matrix such that for any positive semidefinite $$B$$ the matrix $$A\odot B$$ is positive semidefinite.
Consider matrix $$B=\begin{pmatrix}1&\dots&1\\\vdots&\ddots&\vdots\\1&\dots&1\end{pmatrix}.$$ It's positive semidefinite, so $$A\odot B$$ is positive semidefinite. On the other hand, $$A\odot B=A$$. Hence $$A$$ is positive semidefinite.