Others view: Celtic knots ♦ Welcome ♦ rss.xml ♦ Reverse complement ♦ 2D Fast Fourier Transform ♦ Biomorphs ♦ Transistor ♦ A star algorithm ♦

**Matrix** (in mathematics) is a rectangular array of values, like

Matrices play the key role in linear algebra and are also important in many other areas of mathematics. Element of matrix is usually denoted by the two subscripts, the row (first) and the column(second). For the matrix above,

This may be contra intuitive as in usual rectangular coordinate system the first coordinate (x) is usually horizontal and in notations goes before the second coordinate (y). The matrix that only has one column (and sometimes also matrix that only has one row) is called a vector.

**Matrix transposition** means exchanging rows with columns and is marked by the superscript T:

**Matrix addition**^{[1]} is relatively simple: values that are at the same location (row and column) in the two matrices are added, producing the result matrix of the same size. On matrices that have the same number of rows and also the same number of columns can be added. Matrix subtraction is similar to addition, just sum is replaced by the difference.

**Matrix multiplication by scalar** (single numeric value) produces a matrix of the same dimensions, where every element of the initial matrix is multiplied by the value of this scalar.

**Matrix multiplication**^{[2]} is more complex operation and is **not** simply a result of multiplication of values at the same positions. Multiplication of matrices **A** and **B** (producing the matrix **C**) is performed following the formula

From this formula is obvious that the number of rows in the first matrix must be equal to the number of columns in the second matrix, and the number of columns in the first matrix must be equal to the number of rows in the second matrix. Vector can be multiplied by matrix that only has one row of the same length as the number of rows in the vector.

Differently from the usual multiplication of the two simple (scalar) values, the order in matrix multiplication is important when A and B are matrices,

**Matrix inverse** can be defined using concept of matrix multiplication. It is said that the matrix **B** is the inversion of the matrix **A** if

where **I** is the *identity matrix*. Identity matrix contains ones in the diagonal and zeros everywhere else, for instance

Inversion can only be computed for a square matrix, and in some cases it does not exist for a square matrix as well. Same as for scalar, for matrices is also true that

**Matrix determinant** is a scalar value that can be computed for a square matrix. It is relatively complex to compute and can only be easily written down for the small matrices, for instance

has determinant

For the bigger matrices, the determinant can be defined through recursion, computing it from formula that contains determinants of the parts of this matrix. These determinants of the smaller matrices can be computed with the same formula having parts of even smaller matrices, until at the end we only need to find determinants of the 2 x 2 matrices that is easy to do. This operation, described at ^{[3]} looks like:

Hence the determinant is can be found from values on the top row, multiplied but determinants of smaller matrices that are missing the top row and also the column, having the position of that value. Every second expression is then multiplied by -1 and the sum is computed.

The matrix is only invertable if its determinant is not zero. Determinant is important in solving linear systems of equations. Surprisingly, the code to compute the determinant is not very complex.

**Matrix adjoint** is similar to the matrix inverse but, unlike inverse, adjoint can be computed for any square matrix and without the need to divide. It is relatively complex to define and compute, please use source code and ^{[4]} for reference.

One of the frequent uses of matrix is to abbreviate a system of linear equations

Here are the unknowns, are the coefficients and are the constant terms.

as

where

^{1 }Rules of Matrix arithmetic^{2 }Matrix multiplication^{3 }How to compute determinants^{4 }Wikipedia about matrix adjoint