Game Development Reference
In-Depth Information
As with addition, in order to be able to subtract two matrices, they
must have the same dimensions. Matrix subtraction is illustrated
by the following example:
1
5
6
2
1
5
6
2
1
6
5
2
5
3
A
B
A
B
2
3
5
8
2
3
5
8
2
5
3
8
7
11
Multiplication
Matrix multiplication is the most important operation that we use with
matrices in 3D computer graphics. Through matrix multiplication we
can transform vectors and combine several transformations together.
Transformations are covered in the next section.
In order to take the matrix product AB , the number of columns of
A must equal the number of rows of B . If that condition is satisfied, the
product is defined. Consider the following two matrices, A and B ,of
dimensions 2 3 and 3 3, respectively:
b
b
b
11
12
13
a
a
a
11
12
13
B
b
b
b
A
21
22
23
a
a
a
21
22
23
b
b
b
31
32
33
We see that the product AB is defined because the number of columns
of A equals the number of rows of B . Note that the product BA , found
by switching the order of multiplication, is not defined because the
number of columns of B does not equal the number of rows of A . This
suggests that matrix multiplication is generally not commutative (that
is, AB BA ). We say “generally not commutative” because there are
some instances where matrix multiplication does work out to be
commutative.
Now that we know when matrix multiplication is defined, we can
give its definition as follows: If A is an m n matrix and B is an n p
matrix, the product AB is defined and is an m p matrix C , where the
ij th entry of the product C is found by taking the dot product of the i th
row vector in A with the j th column vector in B :
(4)
c
a
b
ij
i
j
where a i denotes the i th row vector in A , and b j denotes the j th column
vector in B .
Search WWH ::




Custom Search