Least Squares in Euler Math Toolbox

For an over-determined linear system expressed in matrix form, the matrix A has more rows than columns.  Therefore the inverse of A cannot be found. The trick with least squares is to multiply both sides of the equation by transpose of A and then solve.  This makes the matrix square and invertible.  In Matlab the back slash operator will do matrix division, and if the matrix is over determined, it will attempt to do least squares.

So for the equation Ax = b, Matlab will give the least squares solution:

x = A\b

In Euler Math Toolbox (EMT) A\b will only work for invertible matrices.  So for EMT to do least squares I need to do the extra steps:

x = (A’.A)\(A’.b)