Matrix Calculus

Terms and definitions

As matrix is called a system of elements aij, which are arranged in a 2-dimensional rectangular pattern. The scheme of m-rows and n-columns is called a (m, n)-matrix or a m x n matrix. The position of an element within the matrix is characterized by two subscripts. The first index is the row number and the second index is the column number. The numbering starts at the top left of the matrix and going from left to right and from top to bottom. If for a matrix is n = m then the matrix is called a square matrix.

A=(aij)= ( a11a12a1m a21a22a2m an1an2anm )

Main Diagonal

The elements of the matrix for the subscripts i = j are the main diagonal elements. The elements from the lower left to upper right are referred as secondary diagonal.

Here the main diagonal elements are shown in red color:

( a11a12a1m a21a22a2m an1an2anm )

and the secondary diagonal elements in green color:

( a11a12a1m-1a1m a21a22a2m-1a2m an1an2anm-1anm )

Unit Matrix

The matrix in which all elements of the main diagonal equal to 1 and all other elements are equal to 0 means unit matrix E.

E= ( 100 010 001 )

Transposed Matrix

The matrix mirrored on the main diagonal is called the matrix transpose. For a matrix A = (aij) the transposed matrix AT = (aji). The transposed of a transposed matrix is the matrix itself A = (AT)T.

AT=(aij)T= ( a11a12a1m a21a22a2m an1an2anm )T= ( a11a21an1 a12a22an2 a1ma2manm )

Determinant

Each square matrix can be assigned a unique number, which is called the determinant (det(A)) of the matrix. In general, the determinant of an NxN matrix is defined by the Leibniz formula:

det A= σ Sn ( sgn (σ) Π i = 1 n Aiρ(i) )

here the sum has to be extended over all the permutations σ. Thus, from the elements of A, all possible products are formed for each n-element in such a way that each of the products of each row and column contains exactly one element. These products are added and the sum is the determinant of A. The sign of the summands is positive for even permutations and negative for odd permutations.

Inverse Matrix

The inverse matrix A-1 is defined by the following equation

AA-1=E

Matrices for which an inverse exists is referred to as regular matrices. Matrices which have no inverse are called singular matrices.

For the inverse matrix, the following calculation rules are valid:

(AB)-1=A-1B-1

(A-1)-1=A

The calculation of the inverse matrix A-1 is either done by the Gauss-Jordan algorithm or with the adjuncts. The Gauss-Jordan method transforms the matrix (A | E) in the form (E | A-1) from which the inverse can be read directly. With the adjuncts and the determinant the inverse can be calculated directly as

A-1=1det(A)adj(A)T

Clases of Matrices

A square matrix A is called a symmetric matrix if and only if AT = A and a antisymmetric matrix applies if AT = A. A orthogonal matrix if and only if AT = A-1

Adjungate Matrix

The adjunct of matrix A is calculated in a way that for each matrix element aij is set a sub determinant with removing the line i and the column j. The value of this determinat is multiplied by (-1)i+j that gives the element i,j of the adjungate matrix.

Calculation Rules for Matrices

The matrix multiplication is associative:

A(BC)=(AB)C

The matrix multiplication and matrix addition are distributive:

A(B+C)=AB+AC

For addition and multiplication by real numbers λ, μ:

(λ+μ)A=λA+μA

and:

λ(A+B)=λA+λB

There are zero divisor matrices A ≠ 0 and B ≠ 0 applies to

AB=0

For square matrices is:

det(A+B)=det(A)+det(B)

Matrix Summation

The addition of two matrices A and B is done by adding the elements of the matrices. C = A + B with ci, j = ai, j + b i, j

( a11a12a1m a21a22a2m an1an2anm ) + ( b11b12b1m b21b22b2m bn1bn2bnm ) = ( a11+b11a12+b12a1m+b1m a21+b21a22+b22a2m+b2m an1+bn1an2+bn2anm+bnm )

Calculator for the addition of two matrices:

 

+

 

 

=

 

A general calculator for the sum of NxM matrices is here: Sum and dif of MxN matrices

Matrices Subtraction

The subtraction of two matrices A and B is by subtracting the elements of the matrices. C = A - B with c i, j = a i, j - b i, j

( a11a12a1m a21a22a2m an1an2anm ) - ( b11b12b1m b21b22b2m bn1bn2bnm ) = ( a11-b11a12-b12a1m-b1m a21-b21a22-b22a2m-b2m an1-bn1an2-bn2anm-bnm )

Calculator for subtraction of two matrices:

 

-

 

 

=

 

A general calculator for the subtraction of NxM matrices is here: Sum and dif of MxN matrices

Matrix multiplication by a scalar

Multiplying a matrix by a scalar is by multiplying each by the scalar matrix elements. a * B = a * bi,j

λ ( a11a12a1m a21a22a2m an1an2anm ) = ( λa11λa12λa1m λa21λa22λa2m λan1λan2λanm )

Calculator for the multiplication of a matrix by a scalar:

 

 

 

 

 

=

 

Matrix Multiplication

The multiplication of two matrices A and B requires that the number of columns of the first matrix is equal to the number of rows of the second matrix. The product obtained by multiplying the row and column elements and summed. For the first element of the result matrix, the elements of the first row of the first matrix are multiplied by the elements of the first column of the second matrix and summed. For the other elements the same for the other rows and columns.

( a11a12a1m a21a22a2m an1an2anm ) ( b11b12b1j b21b22b2j bm1bm2bmj ) = ( k=1m(a1kbk1)k=1m(a1kbk2)k=1m(a1kbkj) k=1m(a2kbk1)k=1m(a2kbk2)k=1m(a2kbkj) k=1m(ankbk1)k=1m(ankbk2)k=1m(ankbkj) )

Calculator for the multiplication of two square 3x3 matrices:

 

 

 

=

 

Calculator for the multiplication of a 2x4 matrix with a 4x2 matrix:

 

 

 

=

 

A general calculator for the multiplication of NxM matrices is here: Multiplication of matrices

Sarrus rule

The determinant of a square 3x3 matrix is computed according to the Sarrus rule by subtracting the sum of the products of the main diagonal of the sum of the products of the secondary diagonal.

Determinate

Calculator for the determinant of a 3x3 matrix:

 

det

 

 

=

 

A general determinant solver is here:Determinant NxN

Calculation of the Inverse by Gauss-Jordan

Wanted is the inverse matrix A-1 to the matrix A. For this, first with the identity matrix, the matrix E (A | E) is formed. By suitable transformations we managed to form the (E | A -1 ). In the following the steps of an example can be performed.

A= ( a11a12a1N a21a22a2N aN1aN2aNN )

Gauss-Jordan approach

(A|E)= ( a11a12a1N a21a22a2N aN1aN2aNN | 100 010 001 )

Transformations to get the following shape.

(E|A-1)= ( 100 010 001 | b11b12b1N b21b22b2N bN1bN2bNN )

Calculator for the inverse matrix: Solver Inverse Matrix

Calculation of the adjugate matrix

The adjunct of matrix A is calculated in a way that for each matrix element aij is set a sub determinant with removing the line i and the column j. The value of this determinat is multiplied by (-1)i+j that gives the element i,j of the adjungate matrix.

aij*=(-1)(i+j) | a11a12a1,j-1a1,j+1a1n ai-1,1ai-1,2ai-1,j-1ai-1,j+1ai-1,n ai+1,1ai+1,2ai+1,j-1ai+1,j+1ai+1,n an1an2an,j-1an,j+1ann |

The result is the adjungate matrix.

adj(A)= ( a11*a12*a1n* a21*a22*a2n* an1*an1*ann* )

Calculator for the adjugate matrix: Solver Adjugate matrix

Multiplication of a vector with a matrix

The product of a matrix with a vector is a linear image. The multiplication is explained if the number of columns of the matrix is equal to the number of elements of the vector. The result is a vector whose number of components equals the number of rows of the matrix. This means that a matrix with 2 rows always maps a vector to a vector with two components.

Av= ( a11a12a1m a21a22a2m an1an2anm ) ( v1 v2 vm ) = ( a11v1+a12v2++a1mvm a21v1+a22v2++a2mvm an1v1+an2v2++anmvm )

Calculator for the matrix-vector product: Graphical Matrix-Vector product

Eigenvalue Calculation

The equation

Av=λv

can be transformed into the homogeneous equation system

( A-λE )v=0

The system of equations has a non-trivial solution if and only if the determinant disappears. That if applicable

det ( A-λE )=0

The polynomial is called the characteristic polynomial of A and the equation is the characteristic equation of A. If λi is an eigenvalue of A then the solutions of the characteristic equation are the eigenvectors of A to the eigenvalue λi.

Calculator for eigenvalues: Eigenvalues

More Calculators

Here is a list of of further useful calculators and sites: