Open In App
Related Articles

Matrix Multiplication

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

Matrix Multiplication is a binary operation performed on two matrices to get a new matrix called the product matrix. Suppose we take two matrices A and B such that the number of columns in the first matrix is equal to the number of rows in the second matrix then we can multiply these two matrices to get a new matrix of the same order that is called the multiplication of the two matrices A and B. Thus, it is clear that not any two matrices can be multiplied and we can multiply only those matrices that follow a specific condition. 

French mathematician Jacques Philippe Marie Binet was the first to perform matrix multiplication in 1812. Now let’s learn more about matrix multiplication its properties and others in detail.

What is Matrix Multiplication?

Matrix multiplication is the mathematical operation that is performed on two matrices which when multiplied gives a singular matrix. As we can perform multiplication on any two numbers we can not perform multiplication on any two matrices. We have to follow specific rules to perform matrix multiplication and the matrices obeying a certain relation are the matrices that can be multiplied. 

The multiplication of any two matrices gives a single matrix, and it is possible only if the number of columns in the 1st matrix is equal to the number of rows in the 2nd matrix. If “A = [aij]m×n” and “B = [bij]n×p” are two matrices, then the product of A and B is denoted as AB, whose order is “m × p.” this condition is represented as,

Condition for matrix multiplication

 

Usually, matrix multiplication is not commutative, i.e., AB ≠ BA, or, in simple words, the product of A and B matrices is AB and AB is not equal to BA it is even possible that AB exists but BA does not exist.

How to Multiply Matrices?

Multiplication of the matrix follows a special rule to find the product. Suppose we have to find the multiplication of two matrices A and B where the number of columns in A is equal to the number of rows in B such that the multiplication of A and B is obtained in such a way that we multiply the first row of the first matrix with the first column of the second matrix to get the first element of the multiplied matrix. We follow the steps discussed below to find the matrix multiplication.

Step 1: Check the compatibility of the matrix by checking that the number of columns in the 1st matrix equals the number of rows in the 2nd matrix.

Step 2: Multiply the elements in the first row of the first matrix with the elements in the first column of the matrix and find the sum of all the products. Then multiply the element in the first row of the first matrix with the elements of the second column in the second matrix. Repeat this process till elements of all the positions are not obtained.

Step 3: Substitute all the elements obtained in Step 2 in their respective position to find the required product matrix.

Rules for Matrix Multiplication

Note that the multiplication of any two matrices is possible only if both matrices are compatible. We can multiply two matrices if the number of columns in the 1st matrix is equal to the number of rows in the 2nd matrix, otherwise, the given matrices cannot be multiplied.

  • Let’s take a matrix of size 2×3 and another matrix of size 3×2, then we can apply the multiplication between those matrices because the number of columns in the first matrix is similar to the number of rows in the second matrix. The order of the resultant matrix is 2×2.
  • Now let’s take another matrix of size 3×3 and other matrices of size 4×2, then we cannot multiply these two matrices as the number of columns in the first matrix is not equal to the number of rows in the second matrix.

Notation

We represent a multiplication matrix as the multiplication of two matrices A and B such that the order of A is m×p and the order of B is p×n then the order of the multiplied matrix is m×n. The

X = AB

where,

  • X is the resulting matrix of m×n order
  • A and B are the given matrix of order m×p and p×n

Matrix Multiplication Formula

Let’s take two matrices A and B of order 3×3 such that A = [aij] and B = [bij]. Then the multiplication of A and B is obtained in the image such that,

Matrix Multiplication

 

The resultant multiplication matrix X is represented as,

X = \left[\begin{array}{cc} X_{11} & X_{12}.....X_{1n}\\ X_{21} & X_{22}.....X_{2n} \\..........\\X_{m1} & X_{m2}.....X_{mn}\end{array}\right]

where,

Xxy = Ax1By1 + …..+ AxbBby = Σk= 1b AxkBky

Algorithm for Matrix Multiplication

There are various matrix multiplication algorithms that are widely used for finding matrix multiplication and some of the most common matrix multiplication algorithms are,

  • Iterative Algorithm
  • Divide and Conquer Algorithm
  • Sub-Cubic Algorithms
  • Parallel and Distributed Algorithms

These algorithms are widely used in computer programing to find the multiplication of two matrices such that the results are efficient and take lesser memory and time. They are used to find 2×2, 3×3, and 4×4, multiplication of matrices.

We use these matrix multiplication algorithms for a variety of purposes and the method to multiply matrics is similar for any order of matrix for a particular algorithm.

2×2 Matrix Multiplication Formula

Let us consider two matrices A and B of order “2 × 2”. Then its multiplication is achieved using the formula.

A = \left[\begin{array}{cc} a & b\\ c & d \end{array}\right] and B = \left[\begin{array}{cc} p & q\\ r & s \end{array}\right]

AB = \left[\begin{array}{cc} a & b\\ c & d \end{array}\right] \times \left[\begin{array}{cc} p & q\\ r & s \end{array}\right]

AB = \left[\begin{array}{cc} (ap+br) & (aq+bs)\\ (cp+dr) & (cq+ds) \end{array}\right]

3×3 Matrix Multiplication Formula

Let us consider two matrices P and Q of order “3 × 3”. Now, the matrix multiplication formula of “3 × 3” matrices is,

X = \left[\begin{array}{ccc} x_{11} & x_{12} & x_{13}\\ x_{21} & x_{22} & x_{23}\\ x_{31} & x_{32} & x_{33} \end{array}\right]

Y = \left[\begin{array}{ccc} y_{11} & y_{12} & y_{13}\\ y_{21} & y_{22} & y_{23}\\ y_{31} & y_{32} & y_{33} \end{array}\right]

XY = \left[\begin{array}{ccc} (x_{11}y_{11}+x_{12}y_{21}+x_{13}y_{31}) & (x_{11}y_{12}+x_{12}y_{22}+x_{13}y_{32}) & (x_{11}y_{13}+x_{12}y_{23}+x_{13}y_{33})\\ (x_{21}y_{11}+x_{22}y_{21}+x_{23}y_{31}) & (x_{21}y_{12}+x_{22}y_{22}+x_{23}y_{32}) & (x_{21}y_{13}+x_{22}y_{23}+x_{23}y_{33})\\ (x_{31}y_{11}+x_{32}y_{21}+x_{33}y_{31}) & (x_{31}y_{12}+x_{32}y_{22}+x_{33}y_{32}) & (x_{31}y_{13}+x_{32}y_{23}+x_{33}y_{33}) \end{array}\right]

We can understand this using the example of matrix multiplication discussed below.

Example: Multiply the matrices given below.

\left[\begin{array}{ccc} 3 & -5 & 1\\ -2 & 0 & 4\\ -1 & 6 & 5 \end{array}\right]\left[\begin{array}{ccc} 7 & 2 & 4\\ 0 & 1 & -5\\ 1 & 3 & 2 \end{array}\right]

Solution: 

\left[\begin{array}{ccc} 3 & -5 & 1\\ -2 & 0 & 4\\ -1 & 6 & 5 \end{array}\right]\times\left[\begin{array}{ccc} 7 & 2 & 4\\ 0 & 1 & -5\\ 1 & 3 & 2 \end{array}\right]

=\left[\begin{array}{ccc} (21-0+1) & (6-5+3) & (12-25+2)\\ (-14+0+4) & (-4+0+12) & (-8-0+10)\\ (-7+0+5) & (-2+6+15) & (-4-30+10) \end{array}\right]

=\left[\begin{array}{ccc} 22 & 4 & -11\\ -10 & 8 & 2\\ -2 & 19 & -24 \end{array}\right]

Matrix Multiplication by Scalar

A matrix can be multiplied by a scalar value, which is called scalar multiplication, and also by a matrix, which is called matrix multiplication. Scalar multiplication is the multiplication of a matrix by a scalar value. When a matrix “A = [aij]” is multiplied by a scalar value “k,” every element of the given matrix is multiplied by the scalar value. The resultant matrix is expressed as kA, where kA = k[aij] = [kaij], for all the values of i and j.

Example: 

A = \left[\begin{array}{cc} a & b\\ c & d \end{array}\right]

kA = k \times\left[\begin{array}{cc} a & b\\ c & d \end{array}\right]= \left[\begin{array}{cc} ka & kb\\ kc & kd \end{array}\right]

Properties of Matrix Multiplication

The following are some important properties of matrix multiplication:

Commutative Property

The matrix multiplication is usually not commutative i.e. the multiplication of the first matrix with the second matrix is not similar to the multiplication of the second matrix with the first. 

If A and B are two matrices, then AB ≠ BA. 

Associative Property

The matrix multiplication is associative in nature. If A, B, and C are three matrices, then

 A(BC) = (AB)C

This property holds true if the products A(BC) and (AB)C are defined.

Distributive Property

Distributive property also holds true for matrix multiplication. If A, B, and C are three matrices, then by applying the distributive property, we get 

  • A (B + C) = AB + AC
  • (B + C) A = BA + CA

This property is only true if and only if A, B, and C are compatible.

Product with a Scalar

 If A and B are two matrices and AB is defined, then the product of the matrix with the scaler is defined as,

k(AB) = (kA)B = A(Bk)

where 
k is a scalar value.

Determinant of Matrix Multiplication

If A and B are two matrices and AB is defined as the multiplication product of A and B, then the determinant of the matrix “AB” is equal to the product of the determinants of matrices A and B, i.e., 

det (AB) = det A × det B

Transpose of Matrix Multiplication

If A and B are two matrices and AB is defined as the multiplication of the two matrices then,

(AB)T = BTAT

where 
T represents the transpose of a matrix

Multiplicative Identity Property

Matrix multiplication has an identity property that states that, if we multiply a matrix A by an Identity matrix of the same order then, it results in the same matrix.

A.I = I. A = A

where 
A is an n×n matrix
I is an identity matrix of order n

Multiplicative Property of Zero

Matrix multiplication has the property of zero which states that, If a matrix is multiplied by a zero matrix, then the resultant matrix is a zero matrix.

A.0 = 0.A = 0

where 0 is the zero matrix

Also, the product of any two non-zero matrices may result in a zero matrix, i.e.,

AB = 0

Then that doesn’t mean that A = 0 or B = 0.

Read More,

Solved Examples on Matrix Multiplication

Example 1. Let A =\begin{bmatrix} 1 & 8 & 3\\ 9 & 4 & 5 \\ 6 & 2 & 7 \end{bmatrix}    and B =\begin{bmatrix} 6 & 7 & 4\\ 1 & 3 & 2 \\ 5 & 9 & 8 \end{bmatrix}          Find A×B?

Solution: 

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

=\begin{bmatrix} (1×6 + 8×1 + 3×5) & (1×7 + 8×3 + 3×9) & (1×4 + 8×2 + 3×8)\\ (9×6 + 4×1 + 5×5) & (9×7 + 4×3 + 5×9) & (9×4 + 4×2 + 5×8) \\ (6×6 + 2×1 + 7×5) & (6×7 + 2×3 + 7×9) & (6×4 + 2×2 + 7×8) \end{bmatrix}

=\begin{bmatrix} 29 & 58 & 44\\ 83 & 120 & 84 \\ 73 & 111 & 84 \end{bmatrix}

Example 2. Let  A =\begin{bmatrix} 1 & 5 & 4\\ 9 & 3 & 8 \end{bmatrix}          and B =\begin{bmatrix} 6 & 7 \\ 1 & 3   \\ 5 & 9 \end{bmatrix}         . Find A×B?

Solution:

A \times B =\begin{bmatrix} (1×6 + 5×1 + 4×5) & (1×7 + 5×3 + 4×9) \\ (9×6 + 3×1 + 8×5) & (9×7 + 3×3 + 8×9)\end{bmatrix}

 =\begin{bmatrix} 31 & 58 \\ 97 & 144\end{bmatrix}

Example 3. Let A=\begin{bmatrix} 2 & 0 & -3\\ 1 & 4 & 5 \end{bmatrix}         ,  B=\begin{bmatrix} 3 & 1\\ -1 & 0 \\ 4 & 2\end{bmatrix}           and C=\begin{bmatrix} 4 & 7\\ 2 & 1 \\ 1 & -1\end{bmatrix}         . Find (AB + AC)?

Solution:

A \times B = \begin{bmatrix} 2 & 0 & -3\\ 1 & 4 & 5 \end{bmatrix}\times \begin{bmatrix} 3 & 1\\ -1 & 0 \\ 4 & 2\end{bmatrix} \\ = \begin{bmatrix} (2×3 + 0×(-1) + (-3)×4) & (2×1 + 0×0 + (-3)×2) \\ (1×3 + 4×(-1) + 5×4) & (1×1 + 4×0 + 5×2)\end{bmatrix}

=\begin{bmatrix} -6 & -4 \\ 19 & 11\end{bmatrix}

A \times C = \begin{bmatrix} 2 & 0 & -3\\ 1 & 4 & 5 \end{bmatrix}\times \begin{bmatrix} 4 & 7\\ 2 & 1 \\ 1 & -1\end{bmatrix} \\ = \begin{bmatrix} (2×4 + 0×2 + (-3)×1) & (2×7 + 0×1 + (-3)×(-1)) \\ (1×4 + 4×2 + 5×1) & (1×7 + 4×1 + 5×(-1))\end{bmatrix}

=\begin{bmatrix} 5 & 17 \\ 17 & 6\end{bmatrix}

Now calculate (AB + AC)

= \begin{bmatrix} -6 & -4 \\ 19 & 11\end{bmatrix} + \begin{bmatrix} 5 & 17 \\ 17 & 6\end{bmatrix}

(AB +BC)= \begin{bmatrix} -1 & 13 \\ 36 & 17\end{bmatrix}

Example 4. Let A=\begin{bmatrix} 2  & -2\\ -2 & 2\end{bmatrix}     , and A2 = pA, then find the value of p?

Solution:

Calculating, A2

A2 = A×A = \begin{bmatrix} 2  & -2\\ -2 & 2\end{bmatrix} \times \begin{bmatrix} 2  & -2\\ -2 & 2\end{bmatrix}

=\begin{bmatrix} (2×2 + (-2)×(-2)) & ((2×(-2) + (-2)×2)  \\ ((-2)×2 + 2×(-2)) & ((-2)×(-2) + 2×2)\end{bmatrix}

=\begin{bmatrix} 8 & -8\\ -8 & 8\end{bmatrix}

Given,

A2 = pA

Taking A2 in the equation,

\begin{bmatrix} 8 & -8\\ -8 & 8\end{bmatrix} = p\begin{bmatrix} 2 & -2\\ -2 & 2\end{bmatrix}

\begin{bmatrix} 8 & -8\\ -8 & 8\end{bmatrix} = \begin{bmatrix} 2p & -2p\\ -2p & 2p\end{bmatrix}

Now,

  • 8 = 2p
  • -8 = -2p

p = 4

Thus, the value of p is 4

Example 5: Find the value of 3P if P = \left[\begin{array}{ccc} 2 & -3 & 4\\ 1 & 0 & 5\\ 7 & -4 & 6 \end{array}\right]          .

Solution:

3P = 3 \times\left[\begin{array}{ccc} 2 & -3 & 4\\ 1 & 0 & 5\\ 7 & -4 & 6 \end{array}\right]

3P = \left[\begin{array}{ccc} 3\times2 & 3\times-3 & 3\times4\\ 3\times1 & 3\times0 & 3\times5\\ 3\times7 & 3\times-4 & 3\times6 \end{array}\right]

3P = \left[\begin{array}{ccc} 6 & -9 & 12\\ 3 & 0 & 15\\ 21 & -12 & 18 \end{array}\right]

FAQs on Matrix Multiplication

Q1: Define Matrix Multiplication.

Answer:

In linear algebra, matrix multiplication is one of the binary operations that can be performed on matrices. The multiplication of any two matrices is possible only when the number of columns in the first matrix is equal to the number of rows in the second matrix.

Q2: Can you Multiply Matrices of Order 2×3 and 2×2?

Answer:

We know that the multiplication of any two matrices is possible only when the number of columns in the first matrix is equal to the number of rows in the second matrix. 

Here, the first matrix of order 2×3 has 2 columns, while the second matrix of order 2×2 has 3 rows. Now the number of columns in the first matrix(3) is not equal to the number of rows in the second matrix(2). Hence the matrix can not be multiplied.

Q3: How to find the Multiplication of Two Matrices?

Answer:

The multiplication of any two matrices is achieved only when the number of columns in the first matrix equals the number of rows in the second matrix. That is the order of the matrices should be like Am×n and Bn×p now if we multiply the matrices A and B we get,

A×B = [AB]m×p

Q4: What is the result of the Multiplication of the (2×3) matrix and (3×3) matrix?

Answer:

The result of the multiplication of the (2×3) matrix and (3×3) matrix is a matrix of order, (2×3).

Q5: When is Matrix Multiplication Possible?

Answer:

The matrix multiplication between two matrices is possible only when the number of columns in the first matrix is equal to the number of rows in the second matrix, i.e. if the given matrices are [A]m×n, [B]n×p then the multiplication of matrix is achieved as,

A×B = [AB]m×p

Q6: Is Matrix Multiplication always Commutative?

Answer:

No matrix multiplication does not hold the commutative property, i.e. If A and B are two matrices the,

A×B ≠ B×A



Last Updated : 06 Jun, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads