# pinv() Function & Examples

Use the pinv() matrix function in Calcul.io. Review its syntax, edit working examples, understand the result, and explore related math functions.

## pinv

#### pinv(x)

Try it yourself:

```calculio
pinv([1, 2; 3, 4])
pinv([[1, 0], [0, 1], [0, 1]])
pinv(4)
```

[inv](https://calcul.io/function/inv/index.md)

---

## 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()](https://calcul.io/function/inv/index.md) when a square non-singular inverse exists, [lsolve()](https://calcul.io/function/lsolve/index.md) for systems, and [multiply()](https://calcul.io/function/multiply/index.md) to apply the result. [transpose()](https://calcul.io/function/transpose/index.md) and [qr()](https://calcul.io/function/qr/index.md) 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](https://calcul.io/functions/index.md)
