Search for probability and statistics terms on Statlect
StatLect

Matrix multiplication and linear combinations

by , PhD

The product of two matrices can be seen as the result of taking linear combinations of their rows and columns. This way of interpreting matrix multiplication often helps to understand important results in matrix algebra.

Table of Contents

Terminology

Consider two matrices A and $B$ and their product $AB$. Remember that matrix multiplication is not commutative, so that $AB$ is not the same as $BA $.

When we perform the multiplication [eq1]we say that:

Alternatively, we say that:

Post-multiplying a matrix by a vector

Let us start with the case in which a matrix is post-multiplied by a vector.

Proposition Let A be a $K	imes L$ matrix and $b$ a $L	imes 1$ vector. Then[eq2]where $A_{ullet l}$ denotes the $l$-th column of A.

Proof

The product $Ab$ is a Kx1 vector. By applying the definition of matrix product, the k-th entry of $Ab$ is found to be[eq3]This is also the k-th entry of the linear combination [eq4]

In other words, post-multiplying a matrix A by a vector $b$ is the same as taking a linear combination of the columns of A, where the coefficients of the linear combination are the elements of $b$.

Example Let[eq5]and[eq6]Then, the formula for the multiplication of two matrices gives[eq7]By computing the same product as a linear combination of the columns of A, we get[eq8]

Pre-multiplying a matrix by a vector

We now discuss the case in which a matrix is pre-multiplied by a vector.

Proposition Let $b$ be a $1	imes K$ vector and A a $K	imes L$ matrix. Then[eq9]where $A_{kullet }$ denotes the k-th row of A.

Proof

The product $bA$ is a $1	imes L$ vector. By applying the definition of matrix product, we obtain the $l$-th element of $bA$ as[eq10]which is equal to the $l$-th entry of [eq11]

Thus, pre-multiplying a matrix A by a vector $b$ is the same as taking a linear combination of the rows of A. The coefficients of the combination are the elements of $b$.

Example Let[eq12]and[eq13]Then, the formula for the multiplication of two matrices gives[eq14]By computing the same product as a linear combination of the rows of A, we obtain[eq15]

Post-multiplying a matrix by another matrix

Let us now tackle the more general case in which a matrix is post-multiplied by another matrix.

Proposition Let A be a $K	imes L$ matrix and $B$ an $L	imes M$ matrix. Then, the $m$-th column of the product $AB$ is[eq16]where $A_{ullet l}$ denotes the $l$-th column of A.

Proof

By applying the definition of matrix multiplication, the $left( k,m
ight) $-th entry of $AB$ is found to be[eq17]This is also the k-th entry of the column vector [eq18]

So, the $m$-th column of the product $AB$ is a linear combination of the columns of A, with coefficients taken from the $m$-th column of $B$.

Example Let[eq19]and[eq20]Then, the formula for the multiplication of two matrices gives[eq21]By computing the first column of $AB$ as a linear combination of the columns of A, we get[eq22]The second column can be calculated as[eq23]

Pre-multiplying a matrix by another matrix

In the previous section, the columns of $AB$ were interpreted as linear combinations of the columns of A. We now interpret the rows of $AB$ as linear combinations of the rows of $B$.

Proposition Let A be a $K	imes L$ matrix and $B$ an $L	imes M$ matrix. Then, the k-th row of the product $AB$ is[eq24]where $B_{lullet }$ denotes the $l$-th row of $B$.

Proof

By applying the definition of matrix multiplication, the $left( k,m
ight) $-th entry of $AB$ is found to be[eq25]This is also the $m$-th entry of the row vector [eq26]

So, the k-th row of the product $AB$ is a linear combination of the rows of $B$, with coefficients taken from the k-th row of A.

Example Consider the two matrices [eq27]and[eq28]Then, the formula for the multiplication of two matrices gives[eq29]By computing the first row of $AB$ as a linear combination of the rows of $B$, we obtain[eq30]The second row can be computed as[eq31]

How to cite

Please cite as:

Taboga, Marco (2021). "Matrix multiplication and linear combinations", Lectures on matrix algebra. https://www.statlect.com/matrix-algebra/matrix-multiplication-and-linear-combinations.

The books

Most of the learning materials found on this website are now available in a traditional textbook format.