Computation of (log) determinant of Gramian matrix

267 Views Asked by At

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

There are 1 best solutions below

5
On

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$.