This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Determine if matrix is lower triangular


tf = istril(A)



tf = istril(A) returns logical 1 (true) if A is a lower triangular matrix; otherwise, it returns logical 0 (false).


collapse all

Create a 5-by-5 matrix.

D = tril(magic(5))
D = 5×5

    17     0     0     0     0
    23     5     0     0     0
     4     6    13     0     0
    10    12    19    21     0
    11    18    25     2     9

Test D to see if it is lower triangular.

ans = logical

The result is logical 1 (true) because all elements above the main diagonal are zero.

Create a 5-by-5 matrix of zeros.

Z = zeros(5);

Test Z to see if it is lower triangular.

ans = logical

The result is logical 1 (true) because a lower triangular matrix can have any number of zeros on its main diagonal.

Input Arguments

collapse all

Input array, specified as a numeric array. istril returns logical 0 (false) if A has more than two dimensions.

Data Types: single | double
Complex Number Support: Yes

More About

collapse all

Lower Triangular Matrix

A matrix is lower triangular if all elements above the main diagonal are zero. Any number of the elements on the main diagonal can also be zero.

For example, the matrix


is lower triangular. A diagonal matrix is both upper and lower triangular.


  • Use the tril function to produce lower triangular matrices for which istril returns logical 1 (true).

  • The functions isdiag, istriu, and istril are special cases of the function isbanded, which can perform all of the same tests with suitably defined upper and lower bandwidths. For example, istril(A) == isbanded(A,size(A,1),0).

Extended Capabilities

Introduced in R2014a

Was this topic helpful?