# Solve linear equation system $A'Ax=A'Bz$

For $A$ and $B$ known matrices which are not square matrices, I have the following equation sistem i would like to solve numerically $$A'Ax=A'Bz$$ I want to know which is a numerically stable and fast algorithm that can be used avoiding the computation of $A'A$ which is a full rank matrix. I know i can use Cholesky method if I compute $A'A$, but I guess i could get Cholesky descomposition from $A$ or may be something better.

Thanks a lot

-
A slow but numerically stable method would be to use the QR decomposition. – copper.hat Feb 18 '14 at 17:13
Singular value decomposition, see also here – Jean-Claude Arbaut Feb 18 '14 at 17:14
QR fits my needs. Thanks! – Manuel Feb 18 '14 at 17:45

Assuming you are solving for $x$.

Apply the least squares algorithm to the problem $Ax = Bz$. This is the most efficient way.

Numerical Recipes recommends as follows:

We need to warn you that the solution of a least-squares problem directly from the normal equations is rather susceptible to roundoff error. An alternative, and preferred, technique involves QR decomposition

-
Interesting, Do i need any assumption over $A$ to do this? Do you know which would be the alternative technique? – Manuel Feb 18 '14 at 18:10
@Manuel what do you mean by alternative technique - alternative to least squares or an alternative to QR decomposition implementation of least squares? – gt6989b Feb 18 '14 at 23:43
I missread the warning. I thought that QR descomposition was a different technique to solve the problem, not that It was the method to calculate least squares – Manuel Feb 19 '14 at 22:21

If $A'$ is invertible, your system becomes $Ax=Bz$. Then you can use Gauss-Jordan algorithm, or Gauss-Seidel iterative algorithm, if you want respectively an exact or approximated solution.

-
$A'$ is not a squared matrix – Manuel Feb 18 '14 at 17:26
Oh sorry, I didn't read carefully. I will think about it. – 7raiden7 Feb 18 '14 at 17:33