This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Solving the linear system given by an LU decomposition

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


linalg::matlinsolveLU(L, U, b)
linalg::matlinsolveLU(L, U, B)


linalg::matlinsolveLU(L, U, b) solves the linear system , where the matrices L and U form an LU-decomposition, as computed by linalg::factorLU.

If the third parameter is an n×k matrix B then the result is an n×k matrix X satisfying the matrix equation LUX = B.

The system to be solved always has a unique solution.

The diagonal entries of the lower diagonal matrix L must be equal to one (Doolittle-decomposition, see linalg::factorLU).

linalg::matlinsolveLU expects L and U to be nonsingular.

linalg::matlinsolveLU does not check on any of the required properties of L and U.

The component ring of the matrices L and U must be a field, i.e., a domain of category Cat::Field.

The parameters must be defined over the same component ring.


Example 1

We solve the system


MatR := Dom::Matrix(Dom::Real):
A  := MatR([[2, -3, -1], [1, 1, -1], [0, 1, -1]]); 
I3 := MatR::identity(3)

We start by computing an LU-decomposition of A:

LU := linalg::factorLU(A)

Now we solve the system AX = I3, which gives us the inverse of A:

Ai := linalg::matlinsolveLU(LU[1], LU[2], I3)

A * Ai, Ai * A



An n×n lower triangular matrix of a domain of category Cat::Matrix


An n×n upper triangular form matrix of the same domain as L


An n×k matrix of a domain of category Cat::Matrix


An n-dimensional column vector, i.e., an n×1 matrix of a domain of category Cat::Matrix

Return Values

n-dimensional solution vector or n×k dimensional solution matrix, respectively, of the domain type Dom::Matrix(R), where R is the component ring of A.

Was this topic helpful?