Ok, a quick course in Matrix/Vector calculation:
A matrix is a collection of numbers ordered in a rectangular grid like:
[ 0, 1, 2 ]
[ 2, 3, 5 ]
[ 2, 1, 3 ]
[ 0, 0, 1 ]
The above matrix has 4 rows and 3 columns and as such is a 4 x 3 matrix.
A vector is a matrix with 1 row (a row vector) or 1 column (a column vector).
Normal numbers are called scalars to contrast with matrices.
It is also common to use capital letters for matrices and lowercase letters for scalars.
We can do basic calculation with matrices but there are some conditions.
Addition
Matrices can be added if they have the same dimensions. So a 2x2 matrix can be added to a 2x2 matrix but not to a 3x5 matrix.
[ 1, 2 ] + [ 2, 5 ] = [ 3, 7 ]
[ 2, 4 ] [ 0, 3 ] [ 2, 7 ]
You see that by addition each number at each cell is added to the number on the same position in the other matrix.
Matrix multiplication
Matrices can be multiplied, but this is a bit more complex. In order to multiply matrix A with matrix B, you need to multiply the numbers in each row if matrix A with each column in matrix B. This means that if you multiply an a x b matrix with a c x d matrix, b and c must be equal and the resulting matrix is a x d:
[1,2,3] x [4,6] = [1x4+2x2+3x2, 1x6+2x1+3x3 ] = [4+4+6, 6+2+9 ] = [14, 20]
[1,4,5] [2,1] [1x4+4x2+5x2, 1x6+4x1+5x3 ] [4+8+10, 6+4+15 ] [22, 25]
[2,3]
As you can see, with matrixes, A x B differs from B x A.
Matrix scalar multiplication
You can multiply a matrix with a scalar. In that case, each cell is multiplied with that number:
3 x [1,2] = [ 3, 6]
[4,7] [12,21]
Inverting a matrix
Matrix division is not possible, but you can create an inversion of a matrix such that A x A-inv is a matrix with all zero's except for that main diagonal:
[ 1, 0, 0 ]
[ 0, 1, 0 ]
[ 0, 0, 1 ]
Inverting a matrix can only be done with square matrices and it is a complex job that does not neccesary have a result.
Start with matrix A:
[ 1, 2, 3 ]
A = [ 1, 3, 4 ]
[ 2, 5, 1 ]
We add 3 extra columns and fill them with the unit matrix:
[ 1, 2, 3, 1, 0, 0 ]
[ 1, 3, 4, 0, 1, 0 ]
[ 2, 5, 1, 0, 0, 1 ]
Now we start with the first column. We need to subtract the first row from each other row such that the first column contains only zeroes except for the first row.
In order to do that we subtract the first row once from the second and twice from the third:
[ 1, 2, 3, 1, 0, 0 ]
[ 0, 1, 1,-1, 1, 0 ]
[ 0, 1,-5,-2, 0, 1 ]
Now we repeat this with the second column (twice from the first row and once from the third)
[ 1, 0, 1, 3,-2, 0 ]
[ 0, 1, 1,-1, 1, 0 ]
[ 0, 0,-6,-1,-1, 1 ]
For the third column, we have a slight problem. The pivot number is -6 and not 1. But we can solve this by multiplying the entire row with -1/6:
[ 1, 0, 1, 3, -2, 0 ]
[ 0, 1, 1, -1, 1, 0 ]
[ 0, 0, 1, 1/6, 1/6, -1/6 ]
And now we can subtract the third row from the first and the second:
[ 1, 0, 0, 17/6,-13/6, 1/6 ]
[ 0, 1, 0, -7/6, 5/6, 1/6 ]
[ 0, 0, 1, 1/6, 1/6, -1/6 ]
Ok now we have the inverse of A:
[ 17/6,-13/6, 1/6 ]
[ -7/6, 5/6, 1/6 ]
[ 1/6, 1/6, -1/6 ]
We can write this as:
[ 17,-13, 1 ]
1/6 * [ -7, 5, 1 ]
[ 1, 1, -1 ]
[ 1, 2, 3 ] [ 17,-13, 1 ] [ 6, 0, 0 ] [ 1, 0, 0 ]
A = [ 1, 3, 4 ] x [ -7, 5, 1 ] x 1/6 = 1/6 x [ 0, 6, 0 ] = [ 0, 1, 0 ]
[ 2, 5, 1 ] [ 1, 1, -1 ] [ 0, 0, 6 ] [ 0, 0, 1 ]
Hope this helps a bit.