# If I have a diagonal matrix, is it necessarily the product of two other diagonal matrices?

We know that the product of two diagonal matrices forms another diagonal matrix, since we just multiply the entries.

So my question is, does the converse necessarily hold? In other words, if I have a diagonal matrix, did it necessarily come from the product of two other diagonal matrices?

My gut feeling tells me "No" since in Linear Algebra, all sorts of 'intuition' seem to go wrong.

But I would like a confirmation and perhaps a counter example would be nice.

• Oh dear did I phrase my question poorly? What I had intended is in other words "Is it possible to construct a diagonal matrix using non diagonal square matrices?" – Trogdor Jun 2 '15 at 4:53
• Then you should edit what you intended into your question. In particular, in the question title and at the end of the second sentence, "two other diagonal matrices" should read "two non-diagonal square matrices". – user1551 Jun 2 '15 at 5:50
• After all I think the question is: "It is known that if $A$ and $B$ are both diagonal matrices, $D = AB$ is also a diagonal matrix. Does the converse also holds?" – Empiricist Jun 2 '15 at 5:56
• Ah, that makes more sense. Then the answer is no, as you suspected. For a counterexample, a rotation matrix times its inverse yields the identity, but rotation matrices are not diagonal. – mjqxxxx Jun 2 '15 at 6:32
• $\begin{pmatrix}0&1\\1&0\end{pmatrix}\cdot\begin{pmatrix}0&1\\1&0\end{pmatrix}=?$ (To answer question from your comments, which is different from the question in your post.) – Martin Sleziak Jun 2 '15 at 11:32

I guess we can easily arrive at a counter-example:

Let us take two $2 \times 2$ matrices and multiply them: $$\begin{bmatrix} a&b\\ c&d\\ \end{bmatrix} \times \begin{bmatrix} e&f\\ g&h\\ \end{bmatrix} = \begin{bmatrix} ae+bg&af+bh\\ ce+dg&cf+dh\\ \end{bmatrix}$$

Now for the result to be a diagonal matrix:

$ce=-dg$ and $af=-bh$

So resulting in : $$\begin{bmatrix} ae+bg&0\\ 0&cf+dh\\ \end{bmatrix}$$

So Let us take an example as :

Let $\large c=1,d=-\dfrac{1}{2},e=1,g=2\space$ and $\large \space a=1,b=-\dfrac{1}{4},f=2,h=8$

Hence we arrive at:

$$\begin{bmatrix} 1&-\dfrac{1}{4}\\ 1&-\dfrac{1}{2}\\ \end{bmatrix} \times \begin{bmatrix} 1&2\\ 2&8\\ \end{bmatrix} = \begin{bmatrix} \dfrac{1}{2}&0\\ 0&-2\\ \end{bmatrix}$$

Thus it is not always necessary to have two diagonal matrices give a diagonal matrix...

Hope this helps

• Fixed multiplication Errors XD ... BTW please inform if there are any more errors... But this the general way of doing a lot of matrix and determinant examples during exams! – NeilRoy Jun 2 '15 at 5:12
• FTR, this doesn't really answer the OP – you're answering the question “if $A$ and $B$ are not diagonal, is it possible that $AB$ is diagonal nevertheless?” Perhaps that's what the OP actually meant, but really the question asks “if $D$ is diagonal, do there exist diagonal $A$ and $B$ such that $D = AB$?” That's quite a different matter, and is answered by the other posts. – leftaroundabout Jun 2 '15 at 15:19
• @leftaroundabout No actually the OP stated that that's what he found ... " so is it always necessary that it be so? If not give a counter example " . (I think that's what he meant) – NeilRoy Jun 2 '15 at 15:22

If $D$ is diagonal then $D=ID$ where $I$ is the identity matrix. :)

Of course yes, and there are infinitely many such decompositions $D = AB$. For each diagonal entry $d_i$, you just decompose it into a product $d_i = a_i b_i$ arbitrarily. Letting $A = diag(a_i)$ and $B = diag(b_i)$ you have $D=AB$.

For example, you can have $A = D$ and $B = I$.

Another example is $A = diag(\vert d_i \vert)$ and $B = diag(sgn(d_i))$.