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() for linear systems and det() for determinant work.

Square matrices are the standard case, and singular or nearly singular matrices require care. Inspect dimensions with size(); use qr() or svd() when numerical conditioning is important.

Try Lu in Calcul.io

Start with one of the editable examples above, then replace its arguments with your own values. Keeping the function on a separate calculator line makes the input and result easy to compare. For a longer workflow, assign the result to a variable or reference that line in the next expression.

Check the shown signature before adding optional arguments, and use the related-function links to compare operations with similar purposes.

All functions