Advanced mathematics in plain English
You are here:
Mathematics →
Matrices → Matrix operations
Matrix operations
Matrix Addition and Subtraction
If you have two matrices with the same
dimensions
(the same number of rows and columns), you can add them together. The
result is a third matrix with the same number of rows and columns of
the original two, but with the original matrix elements added together
as follows:
( |
|
)+( |
|
)=( |
(a11 + b11) |
(a12
+ b12) |
(a13 + b13) |
(a21 + b21) |
(a22 + b22) |
(a23 + b23) |
|
) |
In this case I've used numbered symbols instead of actual numbers to
make the procedure as clear as possible (the symbols are numbered with
subscripts according to row and column number).
Basically, you take the number in row 1, column 1 of the first
matrix, add it to the number in row 1, column 1 of the second matrix,
and the result goes in row 1 column 1 of the answer. Then repeat for
row 1, column 2.... and so on for each element in the matrix (each
number in a matrix is called an
element of that matrix).
As for subtracting one matrix for another, this is identical to
addition except that you subtract the matrix elements instead of adding
them.
( |
|
)-( |
|
)=( |
(a11 - b11) |
(a12 - b12) |
(a13 - b13) |
(a21 - b21) |
(a22 - b22) |
(a23 - b23) |
|
) |
Again, both matrices
must have the same number of rows
and the same number of columns; otherwise the idea of subtracting one from the other simply doesn't make sense.
Multiplication of a matrix by a scalar
You can multiply any matrix by a scalar (like, for example, the number
-5.1). Basically, this is equivalent to multiplying every element in
the matrix by that scalar. For example, here I'll multiply a matrix by
-10:
-10 |
( |
|
)=( |
-10 |
-20 |
-30 |
-30 |
-20 |
-10 |
-40 |
-50 |
-60 |
|
) |
Note that multiplying a matrix by a scalar is not the same as real
matrix multiplication - multiplication of one matrix by another -
rather it's just a kind of special case that applies to scalars.
Multiplication of a matrix by another matrix
You can multiply one matrix by another as long as the
first matrix has the same number of
columns as the number of
rows in the
second
matrix. The procedure is a little more complicated than you might
expect, and it takes a bit of getting used to; but the procedure is as
follows:
You multiply each row of the first matrix by each column of the second
matrix.
The result has the same number of rows as the first matrix, and the same
number of columns as the second matrix. Each time you multiply a row in the
first matrix by a column in the second, that gives you one number in the
result. For example, when you multiply the 3rd row in the first matrix by the
1st column in the second matrix, that will give you the number that goes in
the 3rd row and 1st column of the result. (You might want to read this
paragraph a second time!)
But wait, how do you multiply a row by a column and get a single number as
a result? Think about how you go about taking the scalar product of two
vectors! You pair up the first, second, ... elements of either vector,
multiply the individual pairs, then add the pairs together. It's exactly the
same with matrix multiplication:
The first element in a row gets multiplied by the first element in a column,
the second element in a row gets multiplied by the second element in a
column,
the third element in a row gets multiplied by the third element in a
column...
And so on!
When you're done multiplying each pair, you add all the
results together to get a single number, which is the scalar product of that
row and that column.