Вы находитесь на странице: 1из 3

Reviews in ’Introduction to

Robotics’:
Matrix Multiplication
1 Introduction
In mathematics, matrix multiplication or matrix product is a binary op-
eration between matrices that results in a third matrix. Matrix operations in
general are fundamental to robotics, and matrix multiplication is perhaps the
most common one. Though the process is relatively simple, it can become te-
dious over larger matrices.
In this review, the focus will be the process of multiplying two matrices rather
than discussing the theory. Fully solved example and few more complicated
cases are shown here. Keep in mind that matrix multiplication is more of a
skill that can be nurtured with repetition, and less of a theoretical concept that
needs to be understood once. Indeed, it is not uncommon for mistakes to be
made even by people who understand the process completely. As a result, it is
advisable to work out all the examples, no matter how trivial they seem, until
the process becomes a habit.

2 The Method
Suppose A and B are matrices that need to be multiplied. First condition that
needs to be satisfied has to do with the size of each matrix. For the multiplication
to be possible, the columns of the first matrix have to be equal with the rows
of the second. For example, the following three couples of matrices can be
multiplied.
 
  2
A= 2 3 4 B = 3
4

 
  2 8
2 3 4
V = F = 3 9
3 4 5
4 10

8
 
2 24 0.45
e  5
 
0.2 30 0.004 0.39 23  5! 34.5 0.53 

log 5s
R
S =  30 4.87 43 x P =
 4 1! sinh(r)

1
0 54 65 4.32 ex 65.7 r 1900 
0 56.6 π

1
For the above examples, if the order of multiplication is reversed, then matrix
multiplication is not defined because the dimensions of the matrices do not agree.
More generally, a matrix with r × m rows and columns can be multiplied
with any matrix with m × w rows and columns. The resulting matrix will be of
r × w rows and columns.
When the dimensions agree, the process can begin. The elements of the
first row of the left-most matrix will be multiplied with the corresponding
elements of the first column of the right-most matrix. the product of each
pair will then be added. Their sum will give the first element of the first row.
For the second element, the first row elements of the left-most matrix will be
multiplied by the elements of the second column of the right-most matrix, and
their product will be added. For the first element of the second row, the elements
of the second row of the left-most matrix are being multiplied by the elements
of the first column of the right-most matrix and their product is added. The
process is repeated until all rows and columns have been paired.
Consider now the single dimensional matrices (vectors) A and B. Since A
is of 1 × 3 rows and columns, and B is of 3 × 1 rows and columns, they can be
multiplied and they will result in an 1 × 1 matrix (scalar value):

 
  2    
A∗B = 2 3 4 ∗ 3 = 2 ∗ 2 + 3 ∗ 3 + 4 ∗ 4 = 29
4

Matrices V and F can be multiplied as:

 
  2 8    
2 3 4  2 ∗ 2 + 3 ∗ 3 + 4 ∗ 4 2 ∗ 8 + 3 ∗ 9 + 4 ∗ 10 29 83
V ∗F = ∗ 3 9= =
3 4 5 3 ∗ 2 + 4 ∗ 3 + 5 ∗ 4 3 ∗ 8 + 4 ∗ 9 + 5 ∗ 10 38 110
4 10

Generally, matrix multiplication is done using the following formula:

 
  b1,1 b1,2
a a1,2 a1,3
A ∗ B = 1,1 ∗ b2,1 b2,2  =
a2,1 a2,2 a1,3
b3,1 b3,2
 
a1,1 ∗ b1,1 + a1,2 ∗ b2,1 + a1,3 ∗ b3,1 a1,1 ∗ b1,2 + a1,2 ∗ b2,2 + a1,1 ∗ b3,2
a3,1 ∗ b1,1 + a3,2 ∗ b2,1 + a3,3 ∗ b3,1 a3,1 ∗ b1,2 + a3,2 ∗ b2,2 + a3,1 ∗ b3,2

3 Examples
Repeat the examples:

Ex. 1 —
 
  2  
A∗B = 2 3 4 ∗ 3 = 29
4

Ex. 2 —
 
  2  
A∗B = 2 3 ∗ = 13
3

2
Ex. 3 —
 
  2 8  
2 3 4  29 83
A∗B = ∗ 3 9 =

3 4 5 38 110
4 10

Ex. 4 —
     
2 3 4 2 8 1 17 32 69
A ∗ B = 3 4 5 ∗ 3 0 9  = 23 44 89
5 1 6 1 4 10 19 64 74

Ex. 5 —
     
2 8 1 2 3 4 33 39 54
B ∗ A = 3 0 9  ∗ 3 4 5 = 51 18 66
1 4 10 5 1 6 64 29 84
* Notice how A ∗ B 6= B ∗ A

Ex. 6 —
     
6 3 4 8 73
A ∗ B = 3 2 5 ∗ 3 = 50
5 0 6 4 64

Ex. 7 —
     
2 3 4 2 8 1 0 108 49 18 67
A∗B = 3
 4 5 ∗  34 3 0 9  = 144.5 66 23 86
5 1 6 0.5 6 4 10 47 79 29 69

Ex. 8 —
     
1 0 0 2 8 1 2 8 1
A ∗ B = 0 1 0 ∗ 3 0 9  = 3 0 9
0 0 1 1 4 10 1 4 10

Ex. 9 —
 
2 8 1 0
 34 3 0 9
     
2 3 4 1 0 2 0 0.5
 6 4 10
 112 51 33 67
A ∗ B = 3 1 0.1 0 4 3 5 ∗

0 0 1 1 = 59.05 57.6 38.4 10
0 0 1 5 1 2 6 2
 3 1 0 8.5 27 22 15
2 1 7 1
1 3 2 0

* Note: By all means use every tool available (calculators, Matlab, Math-
ematica) to validate your process and results. However, the main purpose of
those examples is to practice by hand and become proficient for the many matrix
multiplications that would be required during the course.

Вам также может понравиться