# Prove that $A \circ B = AB$ if and only if both $A$ and $B$ are diagonal

Definition. Hadamard product. Let $A,B \in \mathbb{C}^{m \times n}$. The Hadamard product of $A$ and $B$ is defined by $[A \circ B]_{ij} = [A]_{ij}[B]_{ij}$ for all $i = 1, \dots, m$, $j = 1, \dots, n$.

Remark. See details in this Hadamard product wiki article.

There is the following remark in Million's paper in Chapter 2:

We can relate the Hadamard product with matrix multiplication via considering diagonal matrices, since $A \circ B = AB$ if and only if both $A$ and $B$ are diagonal.

So there is a theorem, that $A \circ B = AB$ if and only if both $A$ and $B$ are diagonal, but I don't know how to prove it, and I didn't find it in the literature, because not many books have written in this topic.

Edit. In this theorem probably $m=n$. Million didn't write about it.

• If you mean by $AB$ the standard product , isn't $m=n$? – Hamou Aug 21 '14 at 18:39
• Yes, you are right, in this theorem $m = n$. – user153012 Aug 21 '14 at 18:51

The theorem you are trying to prove is not true:

Consider $A = B = \left(\begin{array}{cc} 1 & 0\\ 1 & 0\end{array}\right)$.

• Also the other direction is wrong? This part of @brd's proof seems good for me. What do you think? – user153012 Aug 25 '14 at 11:00
• The other direction ($A$, $B$ diagonal $\implies A \circ B = AB$) is right indeed (it would not be an exaggeration to call this implication trivial, though). – Seub Aug 25 '14 at 11:11
• Generalizing this example, any projection all of whose elements are $1$ or $0$ will do the job. – Ian Aug 26 '14 at 18:49
• @Ian and can you say any condition to complete the statment? So I mean a necessary and sufficient condition. – user153012 Aug 26 '14 at 20:03
• I would be surprised that there is a nice necessary and sufficient condition to write (other than the ugly system of equations), but I could be wrong. – Seub Aug 26 '14 at 20:09

Proof: (assuming $n=m$)

($\Rightarrow$) by assumption, $A$ and $B$ are diagonal. Then $AB = diag(a_{11}b_{11}, a_{22}b_{22}, \dots, a_{nn}b_{nn})$ and $[A\circ B]_{i,j} = [A]_{i,j} [B]_{i,j}$. Since $A$ and $B$ are diagonal, then $[A\circ B]_{i,j} = 0$ for all $i\neq j$, and $[A\circ B]_{i,i} = a_{ii}b_{ii}$ $\Rightarrow$ $[A\circ B]_{i,j} = diag(a_{11}b_{11}, a_{22}b_{22}, \dots, a_{nn}b_{nn})=AB$

($\Leftarrow$) (retracted)

• Thanks a lot, nice proof, I'm really sorry, but I don't understand the end of your post. "This produces a set of $n$ linear equations in $n^4$ unknowns, ..." If $i$ runs from $1$ to $n$ and $j$ also runs from $1$ to $n$, then how could it be $n$ equations? And $n^4$ unknowns? And I did not see from where the solutions come from. Can you write about it a little bit more? Thanks! – user153012 Aug 22 '14 at 19:08
• There are $n^2$ equations corresponding to $n^2$ entries of $AB$. Also, the equations are not linear (for example: $a_{ij}b_{ij}$). – Quang Hoang Aug 25 '14 at 10:28
• I downvoted this answer because it is not a proof ("whose only non-trivial solution is..": Why? Prove it!). Also, what it claims to prove is false (if I'm not mistaken, see my answer). – Seub Aug 25 '14 at 10:41