logo back up home forward   further reading more topics »

Maths - Matrix Arithmetic

Matrix Addition

To add matrices just add the corresponding elements, the matrices being added must have the same dimensions, example are shown on the following pages:

Matrix Subtraction

To subtract matrices just subtract the corresponding elements, the matrices being subtracted must have the same dimensions, example are shown on the following pages:

Matrix Multiplication

To multiply matrices,

[M] = [A][B]

mik = sums=1p(aisbsk)

In other words, to work out each entry in the matrix, we take the row from the first operand and the column from the second operand:

a00 a01
a10 a11
b00 b01
b10 b11
=
a00 a01
b00
b10
a00 a01
b01
b11
a10 a11
b00
b10
a10 a11
b01
b11

This single row times a single column is equivalent to the dot product:

a00 a01
a10 a11
b00 b01
b10 b11
=
a00*b00 + a01*b10 a00*b01 + a01*b11
a10*b00 + a11*b10 a10*b01 + a11*b11

Example are shown on the following pages:

It is important to realise that the order of the multiplicands is significant, in other words [A][B] is not necessarily equal to [B][A]. In mathematical terminology matrix multiplication is not commutative.

It we need to change the order of the terms being multiplied then we can use the following:

([A] * [B])T = [B]T * [A]T

Identity Matrix

The identity matrix is the do nothing operand for matrix multiplication, so if the identity matrix is denoted by [I] then,

[I][a] = [a]

The identity matrix is a square matrix with the leading diagonal terms set to 1 and the other terms set to 0, for example:

1 0 0
0 1 0
0 0 1

Since matrix multiplication is not commutative if [I][a] = [a] then is it necessarily true that [a][I] = [a] ?

Also if [b][b]-1=[I] then does [b]-1[b] =[I] ?

try calculating the following:

a00 a01 a02
a10 a11 a12
a20 a21 a22
1 0 0
0 1 0
0 0 1

and

1 0 0
0 1 0
0 0 1
a00 a01 a02
a10 a11 a12
a20 a21 a22

 

Division and Inverse matrix

We don't tend to use the notation for division, since matrix multiplication is not commutative we need to be able to distinguish between [a][b]-1 and [b]-1[a].

So instead of a divide operation we tend to multiply by the inverse, for instance if,

[m] = [a][b]

then,

[m][b]-1 = [a][b][b]-1

because [b][b]-1=[I] we can remove [b][b]-1 -- is this true???

[m][b]-1 = [a]

For more information about inverse matrix see this page.


metadata block
see also:

 

Correspondence about this page david

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

cover Mathematics for 3D game Programming - Includes introduction to Vectors, Matrices, Transforms and Trigonometry. (But no euler angles or quaternions). Also includes ray tracing and some linear & rotational physics also collision detection (but not collision response).

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to the software project, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.

cover Mathmatica

Can you help?

Please send me any improvements to here. I would appreciate ideas to make the pages more useful including error correction, ideas for new pages, improvements to wording. It helps if you quote the full URL of the page.

 

Terminology and Notation

Specific to this page here:

 

program

I am working on a project which uses these principles, if you would like to help me with this you are welcome to join in, here:

http://sourceforge.net/projects/mjbworld/

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2008 Martin John Baker - All rights reserved - privacy policy.