# Are the diagonals of both these matrices related to a positive-semidefinite matrix equal?

Consider a real positive semi-definite matrix $M$, it is known that there exists a unique real positive semi-definite matrix $S$ such that $S^2=M$ and there is also a unique real lower-triangular matrix $C$ with non-negative diagonal such that $CC^*=M$.

Can we conclude that $C$ and $M$ coincide in the diagonal? It seems to be true for all the matrices I have tried.

• One of the matrices is the cholesky matrix and the other is the principal square root. – Jorge Fernández Hidalgo Jan 27 '17 at 0:54
• Per this question, the diagonal entries of $C$ will always have the form $$C_{kk} = \sqrt{\frac{\det M_k}{\det M_{k-1}}}$$ I don't believe that this is true for $S$. – Omnomnomnom Jan 27 '17 at 1:02
• dang it, I just need a program to calculate the square root of a matrix in c++ , but I only need the diagonal. But I haven't been able to find a package that handles this in the "semi-definite" case ;( – Jorge Fernández Hidalgo Jan 27 '17 at 1:04
• Armadillo can do it, but it crashes in the semi-definite case, it's a huge bummer ;'( – Jorge Fernández Hidalgo Jan 27 '17 at 1:05
• Well, if you can find the kernel of $A$, then you can reduce the problem to finding the square root of a smaller positive definite matrix. – Omnomnomnom Jan 27 '17 at 1:09

The statement fails to hold for $$M = \frac 13\pmatrix{1&1&1\\1&1&1\\1&1&1} \implies \\ C = \frac 1{\sqrt 3}\pmatrix{1&0&0\\1&0&0\\1&0&0}, \quad S = M$$ I'm not sure about the $2 \times 2$ case, specifically. I would think that the statement also fails for $M + \epsilon I$, with $\epsilon > 0$ sufficiently small.