Matrix Multiplication Rules & Formula

In this tutorial, you will learn all about matrix multiplication. Here I've shown steps involed in matrix multiplication through pictorial representation. And I think pictorial representation is the best things to define any little complecated topics. Therefore, here is the two topics you are going to aware about:

  • What the Matrix is ?
  • How the multiplication of two matrix performs ?

I'll explain these two topics, in the term that can be understandable for any programmer over here.

What is Matrix ?

In Programming world, matrix is basically a two-dimensional (2D) array. Here two dimension means, the element of array arranged in two dimensions that are rows and columns. Rows are from top-to-bottom, whereas columns are from left-to-right. For example,

matrix multiplication

As you can see from the above matrix, there are total of m numbers or rows and n numbers of columns. And A11, A12, ....., Amn are the elements of matrix, arranged in a way, that the element

  • A11 is at 1st row, 1st column
  • A12 is at 1st row, 2nd column
  • A1n is at 1st row, nth column
  • A21 is at 2nd row, 1st column
  • A22 is at 2nd row, 2nd column
  • A2n is at 2nd row, nth column
  • Am1 is at mth row, 1st column
  • Am2 is at mth row, 2nd column
  • Amn is at mth row, nth column

How Matrix Multiplication Performs ?

To multiply any two matrices, we need to do the dot product of rows and columns. Before going to the step-by-step process of matrix multiplication. Let's first understand about matrix dot product. So to do the dot product of (1,2,3).(4,5,6). Here are the steps:

(1,2,3).(4,5,6)
=(1x4)+(2x5)+(3x6)
=4+10+18
=32

Now let's understand about matrix multiplication using the step by step process given below.

Step by Step Process of Matrix Multiplication

Here are the step by step process to multiply the two given matrix:

matrix multiplication steps

In first step, perform the dot product of first row's elements (of first matrix) to first column's elements (of second matrix) as shown below:

matrix multiplication first step

In second step, perform the dot product of first row's elements (of first matrix) to second column's elements (of second matrix) as shown below:

matrix multiplication second step

In third step, perform the dot product of second row's elements (of first matrix) to first column's elements (of second matrix) as shown below:

matrix multiplication third step

In fourth step, perform the dot product of second row's elements (of first matrix) to second column's elements (of second matrix) as shown below:

matrix multiplication fourth step

In this way, you can perform matrix multiplication.

Condition for Matrix Multiplication to be Perform

In order for matrix multiplication to be perform or defined, the number of columns in first matrix must be equal to the number of rows in second matrix.

Programs Made on This


« Previous Tutorial Next Tutorial »