# lu() Function & Examples

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

Try it yourself:

---

## lu(): LU Matrix Decomposition

**lu()** factors a matrix into lower- and upper-triangular components, commonly with a permutation. This decomposition is useful for solving linear systems, determinants, and repeated calculations using the same coefficient matrix.

## Solving efficiently

Triangular systems can be solved by forward and backward substitution, often more efficiently than repeatedly finding an inverse. Compare this approach with [lsolve()](https://calcul.io/function/lsolve/index.md) for linear systems and [det()](https://calcul.io/function/det/index.md) for determinant work.

Square matrices are the standard case, and singular or nearly singular matrices require care. Inspect dimensions with [size()](https://calcul.io/function/size/index.md); use [qr()](https://calcul.io/function/qr/index.md) or [svd()](https://calcul.io/function/svd/index.md) when numerical conditioning is important.

[All functions](https://calcul.io/functions/index.md)
