Published in

Analytics Vidhya

# 5 Ways to Look at Matrix Multiplication

Hello, I will explain 5 interpretations of matrix multiplication which are necessary to know for machine learning and data science.

We are considering the following general case for all 5 parts.

The first way is actually the definition of matrix multiplication.

1. Each item of matrix C is dot product of the corresponding row from matrix A and corresponding column from matrix B.

Reminder of dot product:

From now on all the followings are just a different interpretation of the first.

2. Each column of C is a linear combination of columns of A with values of the corresponding column in B as weights.

I have written it down in images 5 and 6:

Let’s take a look at first column of C with perspective of image 5:

3. Matrix C can be calculated with adding n matrices of the same size as C when matrix i is multiplication of column i of A and row i of B.

Let’s clarify it with an example:

4. Each row of C is the corresponding row in A multiplied by matrix B.

5. We can divide matrices A and B into blocks and calculate C this way:

The way we divide A and B into blocks might have different options but we should consider that the dimensions of the resulting blocks match the rules of matrix multiplication.

Thanks for reading. Wish you peace. If you liked it you can press clap icon.

--

--

## More from Analytics Vidhya

Analytics Vidhya is a community of Analytics and Data Science professionals. We are building the next-gen data science ecosystem https://www.analyticsvidhya.com