How to multiply a matrix by a vector

We can write a vector as a column matrix, which lets us multiply it by another matrix using the same row-by-column process. Each row produces one component of the answer. Let’s work through a product and see what changes when we reverse the order.

Check the dimensions first

An m×n matrix multiplies an n-component column vector to produce an m-component column vector. Use

M=[4-21030-61-2]
v=[-213]

Use one row to calculate each component

(Mv)1=4(-2)-2(1)+1(3)=-7(Mv)2=0(-2)+3(1)+0(3)=3(Mv)3=-6(-2)+1(1)-2(3)=7
Mv=[-737]

Use a row vector to multiply on the left

If v is written as the row vector [-2,1,3], we can multiply vM. This time the single row combines with each column of M, giving

vM=[-2610-8]

The order and the way we write the vector determine which components are paired.