# UpperTriangularize

gives a matrix in which all but the upper triangular elements of m are replaced with zeros.

UpperTriangularize[m,k]

replaces with zeros only the elements below the k subdiagonal of m.

# Details

• works even if m is not a square matrix.
• In UpperTriangularize[m,k], positive k refers to subdiagonals above the main diagonal and negative k refers to subdiagonals below the main diagonal.
• UpperTriangularize works with SparseArray objects.

# Examples

open allclose all

## Basic Examples(2)

Get the upper triangular part of a matrix:

Get the strictly upper triangular part of a matrix:

## Scope(12)

### Basic Uses(8)

Get the upper-triangular part of non-square matrices:

Find the upper-triangular part of a machine-precision matrix:

Upper-triangular part of a complex matrix:

Upper-triangular part of an exact matrix:

Upper-triangular part of an arbitrary-precision matrix:

Compute the upper-triangular part of a symbolic matrix:

Large matrices are handled efficiently:

The number of rows or columns limits the meaningful values of the parameter k:

### Special Matrices(4)

The upper-triangular part of a sparse matrix is returned as a sparse matrix:

Format the result:

The upper-triangular part of structured matrices:

The upper-triangular part of an identity matrix is the matrix itself:

This is true of any diagonal matrix:

Compute the the upper-triangular part, including the subdiagonal, for HilbertMatrix:

## Properties & Relations(2)

Matrices returned by UpperTriangularize satisfy UpperTriangularMatrixQ:

UpperTriangularize[m,k] is equivalent to Transpose[LowerTriangularize[Transpose[m],-k]]:

Wolfram Research (2008), UpperTriangularize, Wolfram Language function, https://reference.wolfram.com/language/ref/UpperTriangularize.html.

#### Text

Wolfram Research (2008), UpperTriangularize, Wolfram Language function, https://reference.wolfram.com/language/ref/UpperTriangularize.html.

#### BibTeX

@misc{reference.wolfram_2020_uppertriangularize, author="Wolfram Research", title="{UpperTriangularize}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/UpperTriangularize.html}", note=[Accessed: 15-April-2021 ]}

#### BibLaTeX

@online{reference.wolfram_2020_uppertriangularize, organization={Wolfram Research}, title={UpperTriangularize}, year={2008}, url={https://reference.wolfram.com/language/ref/UpperTriangularize.html}, note=[Accessed: 15-April-2021 ]}

#### CMS

Wolfram Language. 2008. "UpperTriangularize." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/UpperTriangularize.html.

#### APA

Wolfram Language. (2008). UpperTriangularize. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/UpperTriangularize.html