4. Matrix Multiplication
2026-02-11
Matrix–vector Multiplication
When we are multiplying a m×n matrix A by a vector x, we can write as below:
Ax=a1,1a2,1⋮am,1a1,2a2,2⋮am,2⋯⋯⋱⋯a1,na2,n⋮am,nx1x2⋮xn=a1,1x1+a1,2x2+⋯+a1,nxna2,1x1+a2,2x2+⋯+a2,nxn⋮am,1x1+am,2x2+⋯+am,nxnOrAx=[v1v2⋯vn]x1x2⋮xn=x1v1+x2v2+⋯+xnvn
The result is a m-dimensional vector, or a m×1 matrix.
Tips
- An example:
[142536]789=7[14]+8[25]+9[36]=[58139]
- It's obvious that x=Inx, where In is the n×n identity matrix.
General Definition of Matrix Multiplication (矩阵乘法)
One Definition
Let A=(aik)m×s,B=(bkj)s×n,C=AB. We say the product C is an m×n matrix, whose elements are
cij=k=1∑saikbkj(i=1,…,m;j=1,…,n).
An Example
[142536]2×37911810123×2=[1⋅7+2⋅9+3⋅114⋅7+5⋅9+6⋅111⋅8+2⋅10+3⋅124⋅8+5⋅10+6⋅12]2×2=[5813964154]
The product AB is only defined when the number of columns of A equals the number of rows of B.
Another Definition
AB=A[b1b2⋯bn]=[Ab1Ab2⋯Abn]
Important Note
- AB=BA in general.
- A(BC)=(AB)C
- A(B+C)=AB+AC and (A+B)C=AC+BC
- AC=BC or CA=CB does NOT imply A=B.
- AB=0 does NOT imply A=0 or B=0.
- (AB)T=BTAT, (ABC)T=CTBTAT, etc.
Power of a Square Matrix (矩阵的幂)
We can define Ak:
Ak=kA⋅A⋅…⋅A
The power of a square matrix is only defined for square matrices.
Specifically, we define A0 as the identity matrix In of the same size as A.