Dot Products and Matrix Multiplication
November 29, 2020 2021-10-04 7:52Dot Products and Matrix Multiplication
Dot Products and Matrix Multiplication
While working with matrices, there are two major forms of multiplicative operations: dot products and matrix multiplication. A dot product takes the product of two matrices and outputs a single scalar value. On the other hand, matrix multiplication takes the product of two matrices and outputs a single matrix. In this lesson, we will be discussing these two operations and how they work.
Dot Product in Matrices
Matrix dot products (also known as the inner product) can only be taken when working with two matrices of the same dimension. When taking the dot product of two matrices, we multiply each element from the first matrix by its corresponding element in the second matrix and add up the results.
If we take two matrices and
such that
=
, and
, then the dot product
is given as,
Matrix Multiplication
Two matrices can be multiplied together only when the number of columns of the first matrix is equal to the number of rows in the second matrix.
For matrix multiplication, we take the dot product of each row of the first matrix with each column of the second matrix that results in a matrix of dimensions of the row of the first matrix and the column of the second matrix. For example, for two matrices and
, if
has a dimension
, and
has a dimension
, matrix multiplication is possible and the resulting matrix is of dimension
.
For an easier understanding, let us suppose matrices and
to be of dimensions
each. Taking matrix
and matrix
, the matrix multiplication of
is given as,
Now, let us find the value of ,
Hence, we also conclude that the matrix multiplication is not commutative, i.e., .
Matrix multiplication has a wide range of applications in Linear Algebra as well as Data Science. In this lesson, we discussed some of the major multiplicative operations performed on matrices. Such operations are usually applied to matrices that represent image data in the field of data science. Head onto the next lesson on ‘Matrix Transpose, Determinants, and Inverse‘ to learn about some matrix transformation methods and the concept of determinants.