# Matrix Multiplication

Last Updated : 09 Apr, 2024

Matrix Multiplication is the product of two matrices that result in the formation of one matrix. It is a binary operation performed on two matrices to get a new matrix called the product matrix. Two matrices can only be multiplied if the number of columns of the first matrix is equal to the number of rows of the second matrix.

In this article, we will learn about, Matrix Multiplication, How to Multiply Matrices, Rules for Matrix Multiplication, Examples of Matrix Multiplication, 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.

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.

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,

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.

Note: French mathematician Jacques Philippe Marie Binet was the first to perform matrix multiplication in 1812.

## How to Multiply Matrices?

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.

### Matrix Multiplication 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. Then

X = AB

Where,

• X is Resulting Matrix of m Ã— n Order
• A and B are 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,

The resultant multiplication matrix X is represented as,

X =Â [Tex]\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] [/Tex]

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.

## Matrix Multiplication Rules

Some rules for matrix multiplication are,

• Product of two matrices A and B is defined if the number of columns of A is equal to the number of rows of B.
• If AB multiplication of matrix is defined, then BA multiplication matrix may or may not be defined.
• Both AB and BA matrix multiplication are defined if both A and B are square matrix.
• It is not necessary that one of the matrices is a zero matrix if the product of two matrix A and B is zero.

## 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.

[Tex]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] [/Tex]

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

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

## 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,

[Tex]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] [/Tex]

[Tex]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] [/Tex]

[Tex]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] [/Tex]

### Example: Multiply the matrices given below.

[Tex]\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] [/Tex]

[Tex]\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] [/Tex]

[Tex]=\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] [/Tex]

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

## 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:Â

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

[Tex]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] [/Tex]

Check: Multiply 2 matrices

## 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

### Product with a Scalar

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

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

### 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

### 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

### 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(O).

A.O = O.A = O

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

AB = O

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

## Examples on Matrix Multiplication

Some examples on Matrix Multiplication are,

Example 1. LetÂ [Tex]A~=~\begin{bmatrix} 1 & 8 & 3\\ 9 & 4 & 5 \\ 6 & 2 & 7 \end{bmatrix} [/Tex]Â andÂ [Tex]B =\begin{bmatrix} 6 & 7 & 4\\ 1 & 3 & 2 \\ 5 & 9 & 8 \end{bmatrix} [/Tex]Â Find AÃ—B?

Solution:Â

[Tex]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}Â Â Â Â Â Â Â Â Â Â Â Â Â  [/Tex]Â

=[Tex]\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} [/Tex]

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

Example 2. Let Â [Tex]A =\begin{bmatrix} 1 & 5 & 4\\ 9 & 3 & 8 \end{bmatrix}Â Â Â Â Â Â Â Â Â  [/Tex]Â andÂ [Tex]B =\begin{bmatrix} 6 & 7 \\ 1 & 3 Â  \\ 5 & 9 \end{bmatrix}Â Â Â Â Â Â Â Â Â  [/Tex]. Find AÃ—B?

Solution:

[Tex]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} [/Tex]

[Tex]Â =\begin{bmatrix} 31 & 58 \\ 97 & 144\end{bmatrix} [/Tex]

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

Solution:

[Tex]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} [/Tex]

[Tex]=\begin{bmatrix} -6 & -4 \\ 19 & 11\end{bmatrix} [/Tex]

[Tex]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} [/Tex]

[Tex]=\begin{bmatrix} 5 & 17 \\ 17 & 6\end{bmatrix} [/Tex]

Now calculate (AB + AC)

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

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

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

Solution:

Calculating, A2

A2 = AÃ—A =Â [Tex]\begin{bmatrix} 2 Â & -2\\ -2 & 2\end{bmatrix} \times \begin{bmatrix} 2 Â & -2\\ -2 & 2\end{bmatrix} [/Tex]

=[Tex]\begin{bmatrix} (2Ã—2 + (-2)Ã—(-2)) & ((2Ã—(-2) + (-2)Ã—2) Â \\ ((-2)Ã—2 + 2Ã—(-2)) & ((-2)Ã—(-2) + 2Ã—2)\end{bmatrix} [/Tex]

[Tex]=\begin{bmatrix} 8 & -8\\ -8 & 8\end{bmatrix} [/Tex]

Given,

A2 = pA

Taking A2 in the equation,

[Tex]\begin{bmatrix} 8 & -8\\ -8 & 8\end{bmatrix} = p\begin{bmatrix} 2 & -2\\ -2 & 2\end{bmatrix} [/Tex]

[Tex]\begin{bmatrix} 8 & -8\\ -8 & 8\end{bmatrix} = \begin{bmatrix} 2p & -2p\\ -2p & 2p\end{bmatrix} [/Tex]

Now,

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

p = 4

Thus, the value of p is 4

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

Solution:

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

[Tex]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] [/Tex]

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

## Practice Problems on Matrix Multiplication

Solve the following problems:

P1: Find 9P ifÂ [Tex]P~=~\left[\begin{array}{ccc} 2 & -3 & 4\\ 1 & 0 & 5\\ 7 & -4 & 6 \end{array}\right] [/Tex].

P2: Multiply,Â [Tex]P~=~\left[\begin{array}{ccc} 2 & -3 & 4\\ 1 & 0 & 5\\ 7 & -4 & 6 \end{array}\right] [/Tex] and [Tex]Q~=~\left[\begin{array}{ccc} 3 & -6 & 9\\ 7 & 0 & 8\\ 1 & -4 & 1 \end{array}\right] [/Tex]

P3: Find the product of ABÂ [Tex]A~=~\left[\begin{array}{ccc} 1 & -2 & 3\\ 9 & 0 & 6\\ 8 & -4 & 1 \end{array}\right] [/Tex] and [Tex]B~=~\left[\begin{array}{ccc} 0 & -12 & 7\\ 0 & 0 & 3\\ -21 & -6 & 8 \end{array}\right] [/Tex]

## Conclusion of Matrix Multiplication

Matrix multiplication is a fundamental mathematical operation that involves combining information from two matrices to produce a new matrix. By following specific rules, we can efficiently multiply matrices and obtain results crucial for solving systems of equations, describing geometric transformations, analyzing data relationships, and more. Despite its simplicity, matrix multiplication holds immense significance in various fields, serving as a cornerstone for solving complex problems and advancing research. While it’s essential to understand the rules and properties of matrix multiplication, the practical applications extend far beyond mathematics, making it a vital tool in diverse areas of study and industry.

## Matrix Multiplication – FAQs

### Define Matrix Multiplication.

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.

### Can you Multiply Matrices of Order 2Ã—3 and 2Ã—2?

Now we can not multiply matrices of order 2Ã—3 and 2Ã—2 as 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).

### How to find the Multiplication of Two Matrices?

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

### What is Result of Multiplication of (2Ã—3) Matrix and (3Ã—3) Matrix?

The result of multiplication of (2Ã—3) matrix and (3Ã—3) matrix is a matrix of order, (2Ã—3).

### When is Matrix Multiplication Possible?

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

### Is Matrix Multiplication always Commutative?

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

### What is Matrix Multiplication Formula?

C = A * B

C represents the resulting product matrix.

A represents the first matrix (m x n dimensions).

B represents the second matrix (p x q dimensions).

‘*’ denotes the matrix multiplication operation.

Previous
Next