
Matrix multiplication is not element-wise multiplication—it computes dot products between rows and columns. It models feature weighting, coordinate transformations, and multi-layer neural network propagation.

I’ll start by writing (m × n) @ (n × p) = (m × p). This dimensional rule is more reliable than memorizing formulas.
In previous chapters, we covered the fundamentals of matrix addition and scalar multiplication. Matrix multiplication is a core operation in linear algebra—and especially critical in machine learning and computer science. In this chapter, we will delve deeply into the definition, properties, and practical applications of matrix multiplication.
Definition of Matrix Multiplication
Matrix multiplication is an operation that multiplies two matrices—but not all matrices can be multiplied. Suppose we have two matrices A and B, of dimensions m×n and n×p, respectively. Their product C=AB yields an m×p matrix. Formally, matrix multiplication is defined as:

When learning matrix multiplication, first verify that the number of columns in the left matrix matches the number of rows in the right matrix; then confirm the resulting dimensions and associativity. Do not confuse element-wise multiplication with matrix multiplication.
Cij=k=1∑nAikBkj
This means the entry Cij—located in row i, column j of matrix C—is the sum of the products of corresponding elements from row i of matrix A and column j of matrix B.
Example
Consider two matrices:
A=(1324),B=(5768)
We compute C=AB:
- Compute C11: C11=1⋅5+2⋅7=5+14=19
- Compute C12: C12=1⋅6+2⋅8=6+16=22
- Compute C21: C21=3⋅5+4⋅7=15+28=43
- Compute C22: C22=3⋅6+4⋅8=18+32=50
Thus, matrix C is:
C=(19432250)
Properties of Matrix Multiplication
Matrix multiplication possesses several important properties—widely used in theory and practice. Here are key ones:

When reviewing Matrix Operations: Matrix Multiplication and Properties, you need not tackle large projects at once. Start with one simple example to verify whether the core logic is clear.

If Matrix Operations: Matrix Multiplication and Properties hasn’t yet been fully internalized, revisit the four actions on this card to retrace your learning path.

After finishing Matrix Operations: Matrix Multiplication and Properties, treat the flowchart in this figure as a checklist: Is the problem well-defined? Are operations concretely implemented? Can the evaluation criteria be reused?
- Associativity: Matrix multiplication is associative: (AB)C=A(BC).
- Distributivity: Matrix multiplication distributes over addition:
A(B+C)=AB+AC and (A+B)C=AC+BC.
- Non-commutativity: In general, matrix multiplication is not commutative: AB=BA.
- Identity Matrix: There exists an identity matrix In such that for any n×n matrix A, AIn=InA=A.
Associativity Example
Consider three matrices:
A=(1324),B=(5768),C=(9111012)
We compute both (AB)C and A(BC) to verify equality.
- Compute AB:
AB=(1⋅5+2⋅73⋅5+4⋅71⋅6+2⋅83⋅6+4⋅8)=(19432250)
- Compute (AB)C:
(AB)C=(19432250)(9111012)=(19⋅9+22⋅1143⋅9+50⋅1119⋅10+22⋅1243⋅10+50⋅12)
Carrying out the arithmetic yields:
(AB)C=(209553244640)
- Compute BC:
BC=(5⋅9+6⋅117⋅9+8⋅115⋅10+6⋅127⋅10+8⋅12)=(99119108140)
- Compute A(BC):
A(BC)=(1324)(99119108140)=(1⋅99+2⋅1193⋅99+4⋅1191⋅108+2⋅1403⋅108+4⋅140)
Computing gives:
A(BC)=(337603388712)
Wait—this contradicts associativity! Let’s double-check our arithmetic.
Actually, the earlier calculation of (AB)C contains an error. Correct computation:
- C11=19⋅9+22⋅11=171+242=413
- C12=19⋅10+22⋅12=190+264=454
- C21=43⋅9+50⋅11=387+550=937
- C22=43⋅10+50⋅12=430+600=1030
So (AB)C=(4139374541030).
Now recompute A(BC) correctly:
- BC=(5⋅9+6⋅117⋅9+8⋅115⋅10+6⋅127⋅10+8⋅12)=(45+6663+8850+7270+96)=(111151122166)
Then:
- A(BC)=(1324)(111151122166)=(1⋅111+2⋅1513⋅111+4⋅1511⋅122+2⋅1663⋅122+4⋅166)=(111+302333+604122+332366+664)=(4139374541030)
✅ Indeed, (AB)C=A(BC)=(4139374541030). This confirms associativity.
Real-World Application Example
In machine learning, matrix multiplication underpins numerous algorithms. For instance, consider a simple linear regression model:
Y