Hotmath
Math Homework. Do It Faster, Learn It Better.

Multiplying a Vector by a Matrix

To multiply a row vector by a column vector, the row vector must have as many columns as the column vector has rows.

Let us define the multiplication between a matrix A and a vector x in which the number of columns in A equals the number of rows in x .

So, if A is an m × n matrix, then the product A x is defined for n × 1 column vectors x . If we let A x = b , then b is an m × 1 column vector. In other words, the number of rows in A determines the number of rows in the product b .

The general formula for a matrix-vector product is

A x = [ a 11 a 12 a 1 n a 21 a 22 a 2 n a m 1 a m 2 a m n ] [ x 1 x 2 x n ] = [ a 11 x 1 + a 12 x 2 + + a 1 n x n a 21 x 1 + a 22 x 2 + + a 2 n x n a m 1 x 1 + a m 2 x 2 + + a m n x n ]

Example :

Find A y where y = [ 2 1 3 ] and A = [ 1 2 3 4 5 6 7 8 9 ] .

By the definition, number of columns in A equals the number of rows in y .

A y = [ 1 2 3 4 5 6 7 8 9 ] [ 2 1 3 ]

First, multiply Row 1 of the matrix by Column 1 of the vector.

[ 1 2 3 ] [ 2 1 3 ] = [ 1 2 + 2 1 + 3 3 ] = 13

Next, multiply Row 2 of the matrix by Column 1 of the vector.

[ 4 5 6 ] [ 2 1 3 ] = [ 4 2 + 5 1 + 6 3 ] = 31

Finally multiply Row 3 of the matrix by Column 1 of the vector.

[ 7 8 9 ] [ 2 1 3 ] = [ 7 2 + 8 1 + 9 3 ] = 49

Writing the matrix-vector product, we get:

A y = [ 13 31 49 ]