Matrices are frequently used in coputer graphics for a veriety of purposes including representation of spatial transforms. Reason for this is the characteristics of a matrix but we will get to that. Lets start with a simple question first. What is a matrix? A matrix is an array of numeric elements that follow certain arithmetic rules. Here is an example.

To understand why matrices are used in computer graphics first we must see what they are capable of doing.

## Matrix Arithmetics

A matrix times a constant results in a matrix where each element has been multiplied with the constant. For example:

As for multiplying two matrices we multiply rows of the first matrix with columns of the second:

Therefore taking a product of two matrices is only possible if the number of columns of the left matrix is the same as the number of rows of the right matrix. To represent the size of a matrix we use a notation as such:

Since for left matrix column size must be same with right matrix row size, a valid multiplication between two matrices should look like this:

Resulting matrix size depends on the left matrix’s row, and right matrix’s column size so:

One important thing you should notice at this point is that matrix multiplications are not commutative. Not only they do not produce the same result, in some cases it may not be valid at all. Thus multiply matrix A with matrix B is not the same thing as multiply B with A:

Although matrix multiplication is not commutative directly, it can be achieved by multiplying the transpose matrices. Considering transpose of is and transpose of is :

To calculate transpose of a matrix all you have to do is switch the rows for columns. Like so which makes in a way since doing this will swap the row and column count:

While this may look insignificent for now, it will be useful when we will talk about matrix forms of vectors since there are two different ways a vector can be represented(column-form, row-form).

## Identity Matrix

There is a special case for matrices where they can have inverses. Just like multiplying with would give you , multiply a matrix with it’s inverse gives you “matrix one” which is called an identity matrix, this also means that multiplying a matrix with identity matrix gives the matrix itself. Identity matrix exists only as a square matrix and it consists of ones down the diagonal and zeroes elsewhere. For example the four by four indentity matrix is:

So while is true is also true.