# Matrix Chapter-5

0
155 Multiplication of Matrix with a Vector can be done in two ways i.e. Inner Product and Outer Product.

Matrix-Vector Inner Product: In algebra, a vector is represented by single column matrix e.g. below given single column matrix is a vector. So, we can say any matrix A with dimensions of m*n is a bunch of m*1 column vectors lined up next to each other. Matrix Vector Inner Product: Assume that a and b are vectors, each with the same number of elements. Then, the inner product of a and b is s.

a’b = b’a = s

where
a and b are column vectors, each having n elements,
a’ is the transpose of a, which makes a’ a row vector,
b’ is the transpose of b, which makes b’ a row vector, and
s is a scalar; that is, s is a real number – not a matrix.

Note this interesting result. The product of two matrices is usually another matrix. However, the inner product of two vectors is different. It results in a real number – not a matrix. This is illustrated below. Then,  a*b = 21 * 42 + 24 *62 + 33 * 27 = 3261.

Note: The inner product is also known as the dot product or as the scalar product.

Matrix- Vector Outer Product: Assume that a and b are vectors. Then, the outer product of a and b is C.

ab’C

where
a is a column vector, having m elements,
b is a column vector, having n elements,
b’ is the transpose of b, which makes b’ a row vector, and
C is a rectangular m x n matrix

Unlike the inner product, the outer product of two vectors produces a rectangular matrix, not a scalar. This is illustrated below. Notice that the elements of Matrix C consist of the product of elements from Vector A crossed with elements from Vector B. Thus, Matrix C winds up being a matrix of cross products from the two vectors.