# Maths - Matrix Algebra

A matrix is a rectangular array of elements which are operated on as a single object. The elements are often numbers but could be any mathematical object provided that it can be added and multiplied with acceptable properties (it must be a field structure - see box on right for details), for example, we can have a matrix whose elements are complex numbers.

### Applications of Matrices

Matrices are widely used in geometry, physics and computer graphics applications. For instance this page discusses how they can be used to represent transforms.

### Relationship to other mathematical quantities

We could think of matrix in many ways, for instance:

• As a vector with rows and columns.
• As a case of a tensor (rank 2 tensor is a matrix).
• As a representation of a set of linear equations.

Matrices are a vector space, that is they have the following operations:

operation notation explanation
addition M[a+b] = M[a] + M[b] the addition of two matrices is done by adding the corresponding elements of the two matrices.
scalar multiplication M[s*a] = s * M[a] a scalar product of a matrices is done by multiplying the scalar product with each of its terms individually.

In addition to being a vector space, matricies have additional structure defined by another multiplication type, this allows us to multiply two matrices and get a third matrix (provided certain conditions about the dimensions are met). This type of multiplication can be thought of as an extension to the 'dot' product of vectors, it is the main type of matrix multiplication and it is discussed on this page.

### Axioms

associativity (a+b)+c=a+(b+c) (s1 s2) a = s1 (s2 a) (a*b)*c=a*(b*c)
commutativity a+b=b+a   not necessarily commutative
distributivity   s*(b+c)=s*b+s*c
(s1+s2)*a=s1*a+s2*a
a*(b+c)=a*b+a*c
(a+b)*c=a*c+b*c
identity a+0 = a
0+a = a
1*a = a a*1 = a
1*a = a
inverses a+(-a) = 0
(-a)+a = 0
a*a-1 = 1
a-1*a = 1
if det[a]≠0

This table gives some of the properties of the matrix operations, note that matrix multiplication is not commutative.

### Relationship to Vectors

Vectors are strongly related to matrices, they can be considered as a one directional matrix. So can we create a matrix from a vector whose elements are themselves vectors? We cannot do this because the elements of the vector must be a mathematical structure known as a 'field' and a vector is not itself a field because it does not necessarily have commutative multiplication and other properties required for a field.

Still it would be nice if we could construct a matrix from a vector (drawn as a column) whose elements are themselves vectors (drawn as a row) :

 6 1 7 5
 8 4 4 2
 2 0 6 9
 1 3 0 3

In order to create a matrix by compounding vector like structures we need to do two things to the 'inner vector':

• We need to take the transpose so that it is a row rather than a column.
• We need a multiplication operation which will make it a field.

To do this we create the 'dual' of a vector, this is called a covector as described on this page.

Regardless of whether we consider vectors as a special case of matrices, or matrices as vectors of vectors, or if we consider vectors and matrices as different types, using vectors and matrices together is very important. A matrix is a way to transform one vector into another vector (and a whole set of vectors into another set of vectors). This allows us to express a linear transform as a single equation:

 Vout 0 Vout 1 Vout 2 Vout 3
=
 m00 m01 m02 m03 m10 m11 m12 m13 m20 m21 m22 m23 m30 m31 m32 m33
 Vin 0 Vin 1 Vin 2 Vin 3

Another possibility is that matrices can have matrices as elements, provided that the elements are all of the same dimension, when this is the case it can be replaced by one big matrix. For instance, if we have an m×n matrix and each of its elements is a p×q matrix, then we could replace it with a single (m*p)×(n*q) matrix.

### Linear Functions

A matrix can represent a linear map or linear operator. If we have a set of simultaneous linear equations:

f1(x,y) = a0 * x + a1 * y
f2(x,y) = a2 * x + a3 * y

This can be represented with vectors and matrices:

 f1(x,y) f2(x,y)
=
 a0 a1 a2 a3
 x y

To solve for x and y we only have to invert the matrix.

As already mentioned arithmetic is done treating matrices as a unit, the way that this arithmetic is done is explained here:

There are also other functions that can be done on matrices as explained here:

### Matrix Calculus

See here for details