Matrix (mathematics)

In mathematics, a **matrix** (plural: **matrices**) is a list of a list of numbers, where each list in the list has the same number of numbers. It's often represented as rectangle of numbers, arranged in **rows** and **columns**. The rows are each left-to-right (horizontal) lines, and the columns go top-to-bottom (vertical). The top-left cell is at row 1, column 1 _(see diagram at right)_.

Matrices are often represented by capital roman letters such as ,  and , and there are rules for adding, subtracting and "multiplying" matrices together, but the rules are different than for numbers. As an example, the product  does not always give the same result as , which is the case for the multiplication of ordinary numbers.

Many natural sciences use matrices quite a lot. In many universities, courses about matrices (usually called linear algebra) are taught very early, sometimes even in the first year of studies. Matrices are also very common in computer science, engineering, physics, economics, and statistics.

## Definitions and notations

The horizontal lines in a matrix are called **rows**. The vertical lines are called **columns**. A matrix with _m_ rows and _n_ columns is called an _m_-by-_n_ matrix (or _m_×_n_ matrix). _m_ and _n_ are called its **dimensions**.

The places in the matrix where the numbers are, are called _entries_. The entry of a matrix called "_A_" that is in the row number _i_ and column number _j_ is called the _i,j_ entry of _A_. This is written as _A_[_i,j_] or _a_<sub>_i,j_</sub>.

defines a _m_ × _n_ matrix called _A._ Each entry in this matrix is called _a_<sub>_i,j_</sub>  when "i" is between 1 and m, and when j is between 1 and n.

### Example

The matrix

is a 4×3 matrix. This matrix has m=4 rows, and n=3 columns.

The element _A_[2,3] or _a_<sub>2,3</sub> is 7.

### Addition

The sum of two matrices is the matrix, which (_i_,_j_)-th entry is equal to the sum of the (_i_,_j_)-th entries of two matrices:

The two matrices have the same dimensions. Here,  is true (and is true in general for matrices of equal dimensions).

### Multiplication of two matrices

The multiplication of two matrices is a bit more complicated. First, find the dimensions of each matrix as , where  is the number of rows, and  is the number of columns. If  has dimensions  and  has dimensions , then the matrix  will have dimensions . The values of and  must be equal, or else the multiplication of the two matrices is impossible.

Multiply each row by each column. In the following example, to get the top left value of the resulting matrix, get the first row of the first matrix, , and the first column of the second matrix, . Then sum the products of each corresponding index: .
This is an example with numbers:
- The result of the multiplication is called the product. The product is another matrix. It has the same number of rows as the first matrix and the same number of columns as the second matrix.
- The multiplication of matrices is not commutative, which means that in general, .
- The multiplication of matrices is associative, which means that .

## Special matrices

There are some matrices that are special.

### Square matrix

A square matrix has the same number of rows as columns, so m=n.

An example of a square matrix is

This matrix has 3 rows and 3 columns: m=n=3.

### Identity

Every square dimension set of a matrix has a special counterpart called the "identity matrix", represented by the symbol . The identity matrix has nothing but zeroes except on the main diagonal, where there are all ones. For example:
is an identity matrix. There is exactly **one** identity matrix for each square dimension set. An identity matrix is special because when multiplying any matrix by the identity matrix, the result is always the original matrix with no change.

### Inverse matrix

An inverse matrix is a matrix that, when multiplied by another matrix, equals the identity matrix. For example:
 is the inverse of
.

The formula for the inverse of a 2x2 matrix,  is:

Where  is the determinant of the matrix. In a 2x2 matrix, the determinant is equal to:

If the determinant is 0, then it is referred to as 'singular', and has no inverse.

### One column matrix

A matrix, that has many rows, but only one column, is called a column vector.

## Determinants

The determinant takes a square matrix and calculates a simple number, a scalar. To understand what this number means, take each column of the matrix and draw it as a vector. The parallelogram drawn by those vectors has an area, which is the determinant. For all 2x2 matrices, the formula is very simple:

For 3x3 matrices the formula is more complicated:

There are no simple formulas for the determinants of larger matrices, and many computer programmers study how to get computers to quickly find large determinants.

### Properties of determinants

There are three rules that all determinants follow. These are:
- The determinant of an identity matrix is 1
- If two rows or two columns of the matrix are exchanged, then the determinant is multiplied by -1. Mathematicians call this _alternating_.
- If all the numbers in one row or column are multiplied by another number _n_, then the determinant is multiplied by _n_. Also, if a matrix _M_ has a column _v_ that is the sum of two column matrices  and , then the determinant of _M_ is the sum of the determinants of _M_ with  in place of _v_ and _M_ with  in place of _v_. These two conditions are called _multi-linearity_.

## Related pages

- Calculus
- Transpose
- Wave function
- Matrix analysis
- Matrix function
- Differential equation
- Classical mechanics
- Gaussian elimination
- Quantum mechanics
- Multivariable calculus
- Numerical linear algebra
- System of linear equations
- Eigenvalues and eigenvectors

## Other websites

- History
- MacTutor: Matrices and determinants
- Matrices and Linear Algebra on the Earliest Uses Pages
- Earliest Uses of Symbols for Matrices and Vectors

- Online books
- Online Calculus Courses