**Greetings!**Some links on this site are affiliate links. That means that, if you choose to make a purchase, The Click Reader may earn a small commission

*at no extra cost to you*. We greatly appreciate your support!

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 $A$ and $B$ such that $A$ = $ \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \\ \end{bmatrix}$, and $B = \begin{bmatrix} 7 & 8 & 9 \\ 1 & 2 & 3 \\ 4 & 5 & 6 \\ \end{bmatrix}$, then the dot product $A \cdot B $ is given as,

$$

A \cdot B

&= \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \\ \end{bmatrix} \cdot \begin{bmatrix} 7 & 8 & 9 \\ 1 & 2 & 3 \\ 4 & 5 & 6 \\ \end{bmatrix} \\

&= 1 \times 7 + 2 \times 8 + 3 \times 9 + 4 \times 1 + 5 \times 2 + \\ & 6 \times 3 + 7 \times 4 + 8 \times 5 + 9 \times 6 = 204

$$

## 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 $A$ and $B$, if $A$ has a dimension $m \times n$, and $B$ has a dimension $n \times p$, matrix multiplication is possible and the resulting matrix is of dimension $m \times p$.

For an easier understanding, let us suppose matrices $A$ and $B$ to be of dimensions $2 \times 2$ each. Taking matrix $A = \begin{bmatrix}1 & 2 \\ 4 & 5 \end{bmatrix}$ and matrix $B = \begin{bmatrix} 6 & 7\\ 8 & 9 \\ \end{bmatrix}$, the matrix multiplication of $A \times B$ is given as,

$$ A\times B =

\begin{bmatrix}

1 \times 6 + 2 \times 8 & 1 \times 7 + 2 \times 9\\

4 \times 6 + 5 \times 8 & 4 \times 7 + 5 \times 9

\end{bmatrix} =

\begin{bmatrix}

22 & 25 \\

64 & 73

\end{bmatrix} $$

Now, let us find the value of $B \times A$,

$$ B \times A =

\begin{bmatrix}

6 \times 1 + 7 \times 4 & 6 \times 2 + 7 \times 5\\

8 \times 1 + 9 \times 4 & 8 \times 2 + 9 \times 5

\end{bmatrix} =

\begin{bmatrix}

34 & 47 \\

44 & 61

\end{bmatrix} $$

Hence, we also conclude that the matrix multiplication is not commutative, i.e., $ A \times B \neq B \times A$.

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.