Matrix Multiplication

Matrix Multiplication
To multiply two matrices, their dimensions must be compatible.
The product AB exists only if the number of columns in matrix A is equal to the number of rows in matrix B.
If matrix A is of size m×p, and matrix B is of size p×n, the product AB will be of size: m×n
Multiplying Matrices
The (i,j)-entry of the product AB is the dot product of row i of matrix A with column j of matrix B:
Example
Consider the rows of the first matrix and the columns of the second matrix.
Take the dot product of each of these pairs of rows and columns:
140253[35−12]=1(3)+2(5)4(3)+5(5)0(3)+3(5)1(−1)+2(2)4(−1)+5(2)0(−1)+3(2)=133715366
Properties of Matrix Multiplication
- A(B+C)=AB+AC
- (A+B)C=AC+BC
- A(BC)=(AB)C
- AI=IA=A
Note: If AB=0, it does not necessarily mean that A or B is the zero matrix!
Matrix Powers
Just like with real numbers, we can multiply a square matrix by itself, raising it to the power of some integer k.
Properties
- A0=I
- (cA)k=ckAk

Example: Matrix Multiplication Criteria
Given that A is 3×2, B is 2×2, C is 4×3, and D is 5×2, which of the following operations are defined?
A) AB
Well-defined. The result is a matrix of size (3×2)A(2×2)B=3×2 .
B) BA
Not defined since the inner dimensions do not match: (2×2)A(3×2)B .
C) DB2
Well-defined. The result is a matrix of size (5×2)D(2×2)B(2×2)B=5×2.

Example: Matrix Multiplication
Compute the products AB and BA given the following matrices:
A=[1−23−45−6], B=210−121
Note that A is 2×3 and B is 3×2, so the product AB is well-defined and is of size (2×3)A(3×2)B=2×2.
AB===[1−23−45−6]210−121[1(2)+3(1)+5(0)−2(2)−4(1)−6(0)1(−1)+3(2)+5(1)−2(−1)−4(2)−6(1)][5−810−12]
The product BA is also well-defined, and will be of size (3×2)B(2×3)A=3×3.
BA===210−121[1−23−45−6]2(1)−1(−2)1(1)+2(−2)0(1)+1(−2)2(3)−1(−4)1(3)+2(−4)0(3)+1(−4)2(5)−1(−6)1(5)+2(−6)0(5)+1(−6)4−3−210−5−416−7−6
Given the matrix A=[1101], find An for any integer n≥1.
Practice: Matrix Multiplication
A=−3−2−1321102,B=200−110−3−13
Compute AB.
Compute A2.