A linear equation system , withÂ
being anÂ
matrix and
, is called an overdetermined linear system. In general, it has no classical solution and you seek a vector
 with the property:
Here, denotes the Euclidean vector norm
.
This problem is called a least square problem. A stable method to solve it is based on factorizing , withÂ
being anÂ
orthogonal matrix,Â
anÂ
orthogonal matrix, andÂ
an
matrix with the propertyÂ
 for allÂ
. This factorization is called a singular value decomposition (SVD).
We write

with a diagonal matrix
. If we assume thatÂ
has full rank, then
 is invertible and it can be shown thatÂ
holds.Â
If we split with
being anÂ
submatrix, then the preceding equation can be simplified to:
Â
SciPy provides a function called svd, which we use to solve this task:
import scipy.linalg...