START First steps Deutsch Guide : Matrix computations

Page contents

Input matrix and selection of submatrices Rank determination, inverse matrix Near singular matrix Hilbert matrix Matrix decompostions Arithmetic expressions in matrices Determine properties of matrices
Various computations are performed with a matrix or one of its submatrices: Inversion, Cholesky, LU, QR or RQ decomposition, eigen value and singular value and decomposition, rank, determinant, norms, etc.

START First steps Deutsch Input matrix and selection of submatrices

The matrix to be investigated is specified as tabular data set each matrix row in one textarea row. If a row has less elements than any other row, it is padded.

Optionally, instead of the input matrix, its transpose may be investigated.

Optionally, thereafter only a submatrix may be investigated, rather than the whole input matrix. The submatrix consists only of some rows and/or columns of the input matrix in arbitrary order. They are exemplary addressed by the following pattern:
6-8,5,3-1 selects rows or columns 6,7,8,5,3,2,1 in this order.

START First steps Deutsch Rank determination, inverse matrix

The rank of a matrix is the dimension of the vector space spanned by its column vectors and coincides with the dimension of the vector space spanned by its row vectors. If the rank is lower than the minimum of the numbers of rows and columns, a rank deficient matrix is given. Due to inevitable round-off errors during computations, rank increasing perturbations frequently occur. I.e. the rank is higher than it should actually be. To avoid this, a threshold is introduced, which is usually not exceeded by rank increasing perturbations. The threshold can be chosen as low, normal or high , also in . A high threshold means that nearly rank deficient full-rank matrices are sometimes considered as rank deficient, while a low threshold means the contrary.

For square full-rank matrices (so-called regular matrices) the inverse matrix is computed and displayed, while other matrices are considered as non-invertible.

START First steps Deutsch Near singular matrix

1   0     0
1 1e-12   0
1   1   1e-14
a near
singular matrix

The right 3×3 matrix is near singular. Depending on the threshold, different results for its rank are obtained.

thresholdlownormalhigh
obtained rank321

Only for low threshold the inverse is computed, otherwise a singular matrix with rank increasing perturbations is assumed.

and Compute

START First steps Deutsch Hilbert matrix

 1/1  1/2  1/3  1/4  1/5 ... 1/30
 1/2  1/3  1/4  1/5  1/6 ... 1/31
 1/3  1/4  1/5  1/6  1/7 ... 1/32
 1/4  1/5  1/6  1/7  1/8 ... 1/33
 1/5  1/6  1/7  1/8  1/9 ... 1/34
 1/6  1/7  1/8  1/9 1/10 ... 1/35
 1/7  1/8  1/9 1/10 1/11 ... 1/36
 ...                         ...
1/30 1/31 1/32 1/33 1/34 ... 1/59
30×30 Hilbert matrix

In numerical mathematics Hilbert matrixes are used as test matrices, because they are positive definite, but tend towards a singular matrix as the number or rows and columns increases. The 30×30 Hilbert matrix displayed right is here computed to be of rank 12, even though it is of rank 30, as pointed out.

All elements of an inverse Hilbert matrix are integers with a chessboard-like alternating sign. If fractional numbers are obtained after inversion, the effect of the limited computer accuracy becomes visible. Since the 30×30 Hilbert matrix is here considered as being singular, as pointed out, no inverse is computed.

and Compute   When loading, some project settings will be adapted.

Exercise: Use Select and/or re-order rows and/or columns to cut off the left upper 10×10 submatrix, which is the 10×10 Hilbert matrix. Choose a low threshold and 17 digits for matrix elements. This matrix is computed with rank 10, such that an inverse is computed and displayed. Transfer this inverse to and compute the inverse again. Compare with the original matrix. You obtain differences up to 6.4·10-6.

START First steps Deutsch Matrix decompostions

Cholesky decomposition

The Cholesky factor of a symmetric positive definite n×nmatrix A is a lower triangular n×nmatrix L. If the latter is multiplied by its transpose, the initial matrix is obtained: A=L·LT. The Cholesky decomposition is used for the solution of linear systems of equations as well as for inversion of positive definite matrices.

For symmetric semi-definite matrices such a decomposition is also possible, however, the matrix L is not triangular, but trapezoidal. E.g., there are columns missing on the right. The number of columns of L equals the rank of A. Bei rangerhöhenden Störungen kann der Rang vom Schwellwert abhängen. In the case of rank increasing perturbations the rank may depend on the threshold.

LU decomposition

The LU decompositon of a general n×n matrix A is a factorisation into a product of a lower triangular n×nmatrix L with exclusively ones on the main diagonal and an upper triangular n×nmatrix U, such that A=L·U holds. The LU decomposition is used for the solution of linear systems of equations as well as for matrix inversion, provided that a Cholesky decomposition is impossible. Only in this case it is computed here.

Cholesky and LU: Pivoting and permutation

Usually, during the Cholesky or LU decomposition a pivoting (swapping of rows and columns) is reasonable or even required. In this case, a n×npermutation matrix P is created such that the decomposition reads:
Cholesky: P·A·PT=L·LT.   LU: P·A=L·U
Optionally, it can be tried to do without pivoting. This may come at the cost of numerical stability and is therefore not recommended. If pivoting is mandatory then it will be performed.

If no pivoting is required or is suppressed, P is the identity matrix and is not displayed.

For the Cholesky decomposition holds: If A has rows and columns that are fully occupied by zeros, then L will miss that many rows and columns. P will be a matrix of landscape format with that many zero columns, i.e. not an exact permutation matrix.

QR or RQ decomposition

The QR decompositon of a general n×m matrix A is a factorisation into a product of an n×n orthogonal matrix Q and an upper triangular n×mmatrix R, such that A=Q·R holds.

The RQ decompositon of a general n×m matrix A is a factorisation into a product of a upper n×m triangular matrix Rand an m×m orthogonal matrix Q , such that A=R·Q holds.

If possible, the reduced form is printed, where the rows or columns of R which only contain zeros, as well as the corresponding rows or columns of Q are not printed.

The matrix Q is chosen such that R has positive main diagonal elements.

Eigenvalue decomposition

The eigenvalue decompositon of a general n×n matrix A is a factorisation into a product of an n×n matrix Q, whos columns are the eigenvectors, and a n×n diagonal matrix Λ, which contains the eigenvalues, such that A·Q=Q·Λ holds. Although A contains only real elements, Q and Λ may contain complex numbers.

For the time being the complete eigenvalue decomposition is supported only for symmetric and triangular matrices as well as for matrices up to type 3×3.

The computatition of characteristic polynomials of larger matrices may bei inexakt because the used method of Faddejew und Leverrier may be numerically unstable. The computatition of roots of such polynomials with is also critical and may yield inexact results or may even fail.

The eigenvalues are sorted by increasing magnitude, and the corresponding eigenvectors in the same order.

Singular value decomposition

The (thin version of the) singular value decompositon of a general n×m matrix A is a factorisation into a product of an n×k (trimmed-down) orthogonal matrix U and a k×k diagonal matrix S as well as an k×m (trimmed-down) orthogonal matrix VT, such that k=min(m,n) and A=U·S·VT hold. Only the main diagonal of S is printed, it contains the singular values of A , sorted in ascending order.

The matrices U and V are in general non-uniquely defined. The determinant of square matrices are chosen positive, with the exception of A being square with a negative determinant. In the latter case V has determinant -1.

START First steps Deutsch Arithmetic expressions in matrices

161063e-4    8.1+80063e-4     pi*16.1063/pi
1610.63%     161063/10000     log(exp(16.1063))
8.1+8.0063   (3,3009-1)*7,0   sqrt(16.1063^2)
2,3009*7,0   3,3009*7,0-7     asin(sin(0.161063))*100
A 4×3 matrix with 12 identical elements

This example shows a4×3 matrix, who's elements are all identical to 16.1063. It shows the broad range of arithmetic expressions accepted by IN DUBIO PRO GEO.

See Arithmetic expressions in input fields.

and Compute

Note that the rank of this matrix is equal to one.

START First steps Deutsch Determine properties of matrices

Only for symmetric and positiv definite and positiv semi-definite matrices a Cholesky decomposition is computed. If this is the case, then the decomposed matrix has this property. If the Cholesky factor is also a square matrix, the matrix is even positive definite.

0.0  -0.80  -0.60
0.8  -0.36   0.48
0.6   0.48  -0.64
An orthogonal matrix

An orthogonal matrix can be identified, as its inverse equals its transpose. The eigenvalues all have magnitude one. The singular values are all equal to one. The right example shows an orthogonal matrix of three rows and three columns. The matrix is not a rotation matrix, because the determinant is equal to -1, not +1. In addition to the rotation there is a reflection (mirroring).

and Compute

To prove that a non-square matrix is orthogonal, you may inspect the QR or RQ decomposition If R . is a unit matrix then the decomposed matrix is orthogonal.

Did you know? The Representation of numbers in the matrices may be modified by the in various ways.

START First steps Deutsch






Ausgleichungslehrbücher