As can be seen from the definition, the addition of two matrices is only defined for matrices of the same size and is commutative.
A+B=BA
Multiplication
While multiplying a matrix by a scalar or adding two matrices is intuitively acceptable, multiplication is a bit different. Let’s first look at the multiplication of a row vector and a column vector.
The multiplication of a row vector A=[a1a2⋯an] of size 1×n and a column vector B=b1b2⋮bn of size n×1 is defined as follows:
If we were to explain this definition in words, it would be “the sum of the products of the elements in the same order,” which is conceptually the same as the dot product of two vectors learned in high school.
The multiplication of two matrices can be thought of as an extension of this concept. The multiplication of a m×n matrix A and a m×k matrix B is defined as follows:
Although the formula might seem complicated, it is merely the result of doing several multiplications of row vectors and column vectors. The element in the n row and k column of the resulting matrix AB from the multiplication of A and B is the same as the dot product of the n row of A and the k column of B. Therefore, the number of columns of A and the number of rows of B must be the same for the multiplication between them to be defined. Also, the multiplication of two matrices generally does not follow the commutative law.
AB=BA
This can be easily verified with a simple example. If we say A=[1011], B=[21−11], then
Let’s assume that A, B, and C are arbitrary matrices of size m×n. Let r and s be arbitrary constants. The following properties of matrix operations hold:
(a) Commutative law for addition:A+B=B+A
(b) Associative law for addition:A+(B+C)=(A+B)+C
(c)(r+s)A=rA+sA
(d)r(A+B)=rA+rB
(e)(rs)A=r(sA)
Assuming A, B, and C are arbitrary matrices of size n×n:
(f) Associative law for multiplication:A(BC)=(AB)C
(g) Distributive law for multiplicationA(B+C)=AB+AC&(A+B)C=AC+BC
It should be noted again that the commutative law does not hold for matrix multiplication.
Jim Hefferon, Linear Algebra(4th Edition). 2020, p235 ↩︎