18

I have a symmetric matrix A. How do I compute a matrix B such that $B^tB=A$ where $B^t$ is the transpose of $B$. I cannot figure out if this is at all related to the square root of $A$.

I've gone through wikimedia links of square root of a matrix.

suomynonA
  • 6,895
user957
  • 3,387

2 Answers2

18

As J. M. says, you need your matrix $A$ to be positive definite. Since $A$, being symmetric, is always diagonalizable, this is the same as saying that it has non-negative eigenvalues. If this is the case, you can adapt alex's comment almost literally for the real case: as we've said, $A$ is diagonalizable, but, also, there exists an orthonormal base of eigenvectors of $A$. That is, there is an invertible matrix $S$ and a diagonal matrix $D$ such that

$$ D = SAS^t , \quad \text{with} \quad SS^t = I \ . $$

Since

$$ D = \mathrm{diag} (\lambda_1, \lambda_2, \dots , \lambda_n) \ , $$

is a diagonal matrix and has only non-negative eigenvalues $\lambda_i$, you can take its square root

$$ \sqrt{D} = \mathrm{diag} (\sqrt{\lambda_1}, \sqrt{\lambda_2}, \dots , \sqrt{\lambda_n} ) \ , $$

and then, on one hand, you have:

$$ \left( S^t \sqrt{D} S \right)^2 = \left( S^t \sqrt{D} S\right) \left(S^t \sqrt{D} S \right) = S^t \left( \sqrt{D}\right)^2 S = S^t D S = A \ . $$

On the other hand, $S^t \sqrt{D} S$ is a symmetric matrix too:

$$ \left( S^t \sqrt{D} S \right)^t = S^t (\sqrt{D})^t S^{tt} = S^t \sqrt{D^t} S = S^t \sqrt{D} S \ , $$

so you have your $B = S^t \sqrt{D} S$ such that $B^t B = A$.

Agustí Roig
  • 17,959
3

What you apparently want here is the Cholesky decomposition, which factors a matrix A into $BB^T$ where $B$ is a triangular matrix. However, this only works if your matrix is positive definite.

  • 3
    The times between this and the comment are miraculously close :) – BBischof Aug 15 '10 at 22:24
  • if the matrix is not positive definite, then is there another property I could use? – user957 Aug 15 '10 at 22:25
  • 2
    if the matrix is not a positive definite, there may not be a real solution. for example, the $1 \times 1$ matrix $A=-1$ does not have a real square root. – morgan Aug 15 '10 at 22:27
  • 1
    On the other hand, if you are OK with complex answers, then if $A$ is diagonalized as $A=U D U^{T}$ with diagonal $D$ and unitary $U$, then take $B=U D^{1/2} U^{T}$. $B$ will have complex entries, since some of the entries of $D$ will be negative. However, $B B^T = U D U^T = A$. – morgan Aug 15 '10 at 22:30
  • Even the "true matrix square root" requires that the eigenvalues of a general matrix A should not lie on the negative real axis for it to have a unique ("principal") square root. See http://books.google.com/books?id=S6gpNn1JmbgC&pg=PA133 for instance. – J. M. ain't a mathematician Aug 15 '10 at 22:36
  • To add another note, since it apparently does not get stressed enough in practice: the relation between the Cholesky decomposition and positive definiteness is "if and only if". If the decomposition can be computed, the matrix is positive definite and vice-versa. – J. M. ain't a mathematician Aug 15 '10 at 23:50
  • another related question - if i now assume matrix is symmetric positive definite, and I have diagonalized the matrix as Q DQ^T, is there a way I can convert this quickly to Cholesky decomposition? – user957 Aug 16 '10 at 01:22
  • Yes: define $L=Q D^{1/2}$, then $A=L L^T$. – morgan Aug 16 '10 at 01:37
  • 1
    alex - I don't think Q D^{1/2} Q going to be triangular matrix. take for example A = ((2,-2),(-2,5)) – user957 Aug 16 '10 at 01:48
  • Sorry, I didn't realize you wanted your $L$ to be lower triangular. – morgan Aug 16 '10 at 03:13
  • One possibility to generate the Cholesky triangle from $\sqrt{D}Q^T$ is to perform a QR decomposition on it. On the other hand, doing a flop count on this process shows that you're better off generating the Cholesky triangle ab initio! – J. M. ain't a mathematician Aug 16 '10 at 04:00