# How to find a matrix that makes a diagonal $\pm1$ matrix congruent to itself?

Suppose $D_0$ is a $K\times K$ diagonal matrix with $\pm1$ as its elements. How to construct a matrix $O$ such that $OD_0O^T=D_0$?(NOTE: I'm sorry for previously missing the transpose on the second $O$)

The interesting case is elements in $D_0$ are not all identical and $O$ is not identity -- otherwise the question is trivial.. Also (thanks to your responses but) let's take $O=(D_0)^p$($p$: odd integer) solutions out of consideration, too.

I now clarify my previously unclear expression that I want to know if there is a non-orthonormal $O$ that satisfies this equation. (orthonormal $A$ means $A^TA=I$)

Thanks much!

• You take $O$ to be the identity. I guess you want $-D_0$ in your formula? Commented Feb 3, 2014 at 19:16
• You take any odd power of D, right? Commented Feb 3, 2014 at 19:18
• Try to reduce it to the case when $D_0$ has $n$ ones followed by $K-n$ negative ones first. From there the problem is a bit more tractable, as you can reduce it to a $2\times2$ block matrix.
– Nate
Commented Feb 3, 2014 at 19:30

Let $O=D_0$. Then $O D_0 O = D_0^3 = D_0$.
In fact any diagonal $O$ whose diagonal entries that satisfy $x^2 = 1$ will do.
• The last sentence is not quite true. It also has to be nonzero where $D_0$ is nonzero. Otherwise $O$ as the zero matrix would vacuously satisfy your condition but not satisfy $OD_0O=D_0$. Commented Feb 3, 2014 at 19:45