UpperTriangularize

UpperTriangularize[m]

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^(th) subdiagonal of m.

Details

Examples

open allclose all

Basic Examples  (3)

Get the upper triangular part of a matrix:

Get the strictly upper triangular part of a matrix:

Get the upper triangular part of a matrix plus the diagonal below the main diagonal:

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:

Applications  (3)

LUDecomposition decomposes a matrix as a product of upper and lower triangular matrices, returned as a triple {lu,perm,cond}:

Extract the strictly lower part of lu with LowerTriangularize and place ones on the diagonal:

Extract the upper part of lu with UpperTriangularize:

Display the three matrices:

Reconstruct the original matrix as a permutation of the product of l and u:

SchurDecomposition gives a 2×2-block upper triangular matrix:

Verify this matrix is upper triangular starting from the first subdiagonal:

JordanDecomposition relates any matrix to an upper triangular matrix via a similarity transformation m=s.j.TemplateBox[{s}, Inverse]:

Visualize the three matrices:

Verify that the Jordan matrix is upper triangular and similar to the original matrix:

The matrix is diagonalizable iff its Jordan matrix is also lower triangular:

Properties & Relations  (11)

Matrices returned by UpperTriangularize satisfy UpperTriangularMatrixQ:

The inverse of an upper triangular matrix is upper triangular:

This extends to arbitrary powers and functions:

The product of two (or more) upper triangular matrices is upper triangular:

The determinant of a triangular matrix equals the product of the diagonal entries:

Eigenvalues of a triangular matrix equal its diagonal elements:

QRDecomposition gives an upper triangular matrix:

CholeskyDecomposition gives an upper triangular matrix:

JordanDecomposition gives an upper triangular matrix:

HessenbergDecomposition returns a matrix that is upper triangular with an added subdiagonal:

HermiteDecomposition gives an upper triangular matrix:

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.

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

BibTeX

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

BibLaTeX

@online{reference.wolfram_2022_uppertriangularize, organization={Wolfram Research}, title={UpperTriangularize}, year={2008}, url={https://reference.wolfram.com/language/ref/UpperTriangularize.html}, note=[Accessed: 05-December-2022 ]}