# Algorithm for inverse of $X \cdot X^T$

Assume that matrix $A$ is defined as follows:

$A = X \cdot X^T$

Where $X$ is a Real matrix with more columns than rows, and $A$ has a matrix inverse.

One can find the inverse of $A$ defined as $A^{-1}$ using Gaussian Elimination, or LU Decomposition (find articles here and here on pivoting), but this has a complexity of $O(n^3)$.

Knowing that this matrix is symmetric and (I think?) positive definite, is there a faster way to compute the exact inverse?

The background on the problem:

For reference, I am trying to use this to quickly solve the following equation for $Z$:

$Z = Y X^T(X X^T)^{-1}X$

Where $X$ and $Y$ are known, and both are Real.

I am solving this in Python code, and I have not been able to find a package to calculate the inverse quickly as I am using exact rationals with the quicktions package. sympy.Matrix.inv is slower than just writing out code to do Gaussian Elimination.

I've seen this article Don't invert that matrix, but I don't know a way to solve this system without inverting a matrix.

• Cholesky factorisation? – copper.hat Jun 7 '17 at 16:16
• Is that the correct equation? It looks like it simplifies to $Z=Y$. – Joppy Jun 7 '17 at 16:48
• Yes, it is the correct equation. It does not simplify to $Z=Y$ – Paul Terwilliger Jun 7 '17 at 17:03
• math.stackexchange.com/questions/182662/… – Keith McClary Jun 7 '17 at 22:26