This is a simple tutorial on how to multiply 2 matrices together. You can speed up doing this using my c++ matrix calculator (download matrix calculator) but I strongly recommend learning how to do them long hand first as you should only use formulae and program that you understand how they work. Multiplying matrices is a useful thing to know as it enables complex algebra to be simplified and i used extensively in 3d computer graphics.
What Matrices can i Multiply Together
You may fin it surprising that only certain size matrices can be multiplied together, this is because of the way the multiplication is done and how the size of the answer is determined.
The size of a matrix is given as rows by columns
eg) 2 3 1
3 6 1
is a 2×3 matrix. When multiply matrices the columns of the first matrix must be equal to the rows of the second. The size of the new matrix is given by the rows of the first by the columns of the second
eg) Fig1
How is the multiplication Done
The way in which matrix multiplication is done is surprisingly simple. Go to the first point in the new matrix. Look at the row it is in and go to the start of that row in the first matrix and the start of the column it is in in the second matrix. Multiply these to numbers together, then move along one in the first matrix and down one in the second matrix and multiply these together. Keep going till you have reached the end of the row of the first matrix, now add all of these values up and that is the first value for your new matrix.
So you go to the row in the first, the column in the second, times each pair of values and add them up for each value.
In the above diagram (fig 1)
u=ag + bk
v=ah+bl
w=ai+bm
x=cg+dk
y=ch+dl
and so on….
That may sound a little confusing but you’ll soon get used to it and it is very useful. If you want to practise and check your answers please download my c++ matrix calculator, the command for multiply is mlt, though you will have to define you matrices using the dim command first. All the data it needs off you is asked for
If you have any comments please leave them below or email me at woodford_4@hotmail.co.uk
No comments:
Post a Comment
Please comment if any information is incorrect, could be expanded or you have a question about it.