MATRIX
What is a
matrix? Well a matrix is a thing where you can store and modify data
efficaciously. To define a matrix you need to define how many rows and columns
it has. This is done by first taking the rows number, lets say 2 and then the
columns number lets say 3. This we would call a 2x3 matrix, and it would look
like this:æx x xö
èx x xø
ADDITION AND SUBTRACION WITH MATRICESWe'll start with an
example:
company A's total profit one quarter is;
first quarter: 100,
second quarter 200, third quarter 300, and fourth quarter 400.
And company
B's total profit one quarter is;
first quarter: 400, second quarter 300,
third quarter 200, and fourth quarter 100.
This you can write as: profit
quarter: 1 2 3 4 company A 100 200 300 400 company B 400 300 200 100
Or
just:æ100 200 300 400ö
è400 300 200 100ø
Lets
say that their profit change to the double the next quarter then we get the
total profit for those two quarters is: æ100 200 300 400ö æ200 400 600 800ö æ300 600 900 1200ö
è400 300 200 100ø + è800 600 400 200ø = è1200 900 600 300ø
This
isn't very hard it's just to take the number in the number in the first row,
first column, first matrix and use addition to add it to the first row, first
column, second matrix. And then continue with the number in the first row,
second column, first matrix and use addition to add it to the first row, second
column, second matrix and so on. This also applies to subtraction with matrices.
(Note that you can only use subtraction and addition on matrices that has
the same size)
MULTIPLICATION WITH MATRICESMatrix multiplication is a bit more
difficult, but not much.
Instead of multiplying number by number as in
addition of subtraction you multiply the rows of the matrix on the left side of
the equation by the columns in the matrix on the right side of the
equation.
If we have the two matrices: æA Bö and æC Dö
èa bø èc dø
Then
we start of by taking the first row in the first matrix:æA Bö * æC Dö
èa bø èc dø
And multiply it to the second matrix first column æA Bö * æC Dö
èa bø èc dø
To make the multiplication easier you take the columns of the second
matrix and turn them so that the highest number becomes the number on the left
side. And the lowest number becomes the number on the right side:æCö -> (C c)
ècø
Now you can just multiply them usually number by number:
(A B) * (C c)
= (AC Bc)
And in matrix multiplication, when you take these rows times
the columns you add the factors together:
(A B) * (C c) = (AC+Bc)
Then
you still have the second row in the first matrix and the second column in the
second matrice left. But don't touch the first matrix second row just yet!. Each
row in the first matrix has to get multiplied, in the same fashion as above, by
each column in the second matrix(it might sound confusing). So first we take the
same row as before in the first matrix:æA Bö * æC Dö
èa bø èc dø
And multiply it to the second matrix second column:æA Bö * æC Dö
èa bø èc dø Which if we use the same method as above becomes:
(a b) * (D d) = (aD+bd)
Now we no longer have any columns left in the second matrix. So
therefore we should start over with the first matrix second row.
But first, since the multiplications we preformed above,
was to the same row in the first matrix, we have to combine them
into the same row in the final matrix that we get after multiplication:
(AC+Bc) and (AD+Bd) = (AC+Bc aD+bd)
And then we can start over with
the second row in the first matrix. And multiply it first to the first column in
the second matrix and then moving on the second column:æA Bö * æC Dö
èa bø èc dø
(a b) * (C c) = (aC+bc) æA Bö * æC Dö
èa bø èc dø
(a b) * (D d) = (aD+bd)
And then combine the two
results:
(aC+bc) and (aD+bd) = (aC+bc aD+bd)
Then we put the
results underneath each other. The Row that came from multiplying the first row
in the first matrix gets to be on top. And then the others follow:(AC+Bc aD+bd) = æAC+aB aD+bdö
(aC+bc aD+bd) èaC+bc aD+bdø
And
that is the result of the multiplication.
In multiplication with matrices you don't have to use matrixes of the same size,
as in addition and subtraction. e.g:æA aö * æD Eö
çB b÷ èd eø
èC cø
Works just as fine.
But the amount of numbers in the first matrix rows has to be the same as
in the second matrix columns. Or else you can't multiply them. e.g:æA aö * (D E F)
èB bø
Wont work since, if
we just talke the first matrix first row and try to multiply it to the second
matrix first column you'll see that:
(A a) * (D) = (AD a)
Which means
that there simply isn't enough numbers in the second matrix columns. (It could
also be the other way around, it would have to many numbers)
And also,
unlike with normal numbers, you can't multiply a matrix in any order you want.
If you have two matrices A and B. Then A*B and B*A give two different results.
EXAMPLELets say like this; a company makes a round sum of three
million$ per year and a round sum of 800000$ per quarter and a round sum of
25000$ per month. So we can write it like this:
(1000000 800000
25000)
And then if we would like to know the total amount the company
makes on lets say two years two quarters and three months we could do like this:
æ2ö
ç ÷
(1000000 800000 250000) ç2÷
ç ÷
è3ø
See if you can get that right(you punk).The answer is right below, but
it's written in white colour so you'll have to mark it using the mouse in order
to see it:
4100000
All material is available under the terms of the GNU Free Documentation License