pinv

pinv(x)

Try it yourself:

See also:
inv

pinv(): calculate a pseudoinverse

pinv(A) returns the Moore–Penrose pseudoinverse of a matrix. Unlike an ordinary inverse, it can be defined for rectangular or singular matrices and is often used in least-squares solutions.

Why use it

For an overdetermined system A×x ≈ b, the pseudoinverse gives a solution that minimizes squared error under standard assumptions. It is useful in regression, fitting, and signal reconstruction.

Related linear algebra

Use inv() when a square non-singular inverse exists, lsolve() for systems, and multiply() to apply the result. transpose() and qr() are common related operations.

Caveat

Ill-conditioned input amplifies noise. Scale variables and inspect residuals instead of treating a pseudoinverse as an exact solution.

All functions