Given a matrix $X \in \mathbb{R}^{n \times p}$ with linearly independent columns and $n > p$. Is there a fast way to compute the determinant or log-determinant of $A = X^T X$?

Since $A$ is positive definite, a good option is to compute the Cholesky decomposition of $A$, such that $A = L L^T$, where $L$ is a triangular matrix. This way, $\det(A) = (\det(L))^2$.

Since $L$ is a triangular matrix, $\det(L) = \prod_{i = 1}^p L_{ii}$, with $L_{ii}$ the $i$-th element of $L$'s diagonal.

Then we have that $\det(A) = (\prod_{i = 1}^p L_{ii})^2$, and $\log(\det(A)) = 2 \sum_{i = 1}^p \log(L_{ii})$.

But I was wondering if there is a more direct way that does not involve the Cholesky decomposition. Maybe using $X$ directly.


1 Answer 1


I am assuming that you mean $X \in \mathbb{R}^{n \times p}$, rather than computing $A$ explicitly, and then decompose it, let's decompose $X$ directly.

Let the SVD decomposition of $X=U\Sigma V^T$, where $\Sigma = \begin{bmatrix} diag(\sigma_1, \ldots, \sigma_p) \\ O_{n \times p} \end{bmatrix} , U \in \mathbb{R}^{n \times n}, V \in \mathbb{R}^{p \times p}$.

Then we have $$A=V\Sigma^T UU^T\Sigma V^T=Vdiag(\sigma_1^2, \ldots, \sigma_p^2)V^T$$

Hence $$\det(A)=\prod_{i=1}^p \sigma_i^2$$

That is determinant of $A$ is the product of the square of the singular values of $X$.

  • $\begingroup$ Oh no, I meant $X \in \mathbb{R}^{n \times p}$. I fixed it. Sorry about that. However, your answer could still hold if the dimensions are corrected. $\endgroup$ Feb 11, 2020 at 19:03
  • $\begingroup$ I don't remember exactly how it was, but I think there was an equivalence between Cholesky decomposition and SVD if the matrix was positive definite. Am I right? $\endgroup$ Feb 11, 2020 at 19:10
  • $\begingroup$ If $X \in \mathbb{R}^{n \times p}$, $n <p$, then the columns can't be linearly independent. $\endgroup$ Feb 12, 2020 at 1:49
  • $\begingroup$ Yes, you're totally right. Used the incorrect symbol. It's $n > p$. In the particular case I am thinking about, $X$ is a data matrix with $n$ observations and $p$ variables. $\endgroup$ Feb 12, 2020 at 13:26
  • $\begingroup$ I have changed my answer accordingly. $\endgroup$ Feb 12, 2020 at 13:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .