Open In App

Matrix Multiplication

Last Updated : 23 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

In mathematics, a matrix is a rectangular array of numbers, symbols, or expressions arranged in rows and columns. It is used to represent mathematical objects or to describe properties and relationships between them.

Example: \begin{bmatrix} 5 & 6 & 7 \\ 8 & 9 & 10 \\ 11 & 12 & 13 \end{bmatrix}_{3 \times 3}

The above matrix has 3 rows and 3 columns.

In this article, we will discuss how to multiply matrices, including their notation, rules and conditions, the step-by-step process, formulas, and key properties.

matrix_multiplication
How to multiply matrices

Matrix multiplication is a binary operation that produces a new matrix from two given matrices. For the multiplication to be defined, the number of columns in the first matrix must equal the number of rows in the second matrix. The resulting matrix, called the matrix product, has the same number of rows as the first matrix and the same number of columns as the second matrix. The product of matrices A and B is denoted by AB.

For example, if matrices A and B satisfy this condition, their product results in a new matrix whose order is determined by the rows of A and the columns of B.

Notation for Matrix Multiplication

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,

  • A and B are given a Matrix of Order m × p and p × n,
  • X is the matrices of m × n matrix.

Rules and Conditions for Matrix Multiplication

  • If "A = [aij]m×n" and "B = [bij]n×o" are two matrices, then the product of A and B is denoted as AB, whose order is "m × o". This condition is represented as given in the image.
Condition for matrix multiplication


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

Compatibility Conditions for Matrix Multiplication:

  • 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.
  • For example:
    • A 2×3 matrix can be multiplied by a 3×2 matrix, resulting in a 2×2 matrix.
    • A 3×3 matrix cannot be multiplied by a 4×2 matrix because their dimensions are incompatible.

Special Properties of Matrix Multiplication

  • The 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 a 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 matrices.
  • One of the matrices doesn't need to be a zero matrix if the product of two matrices A and B is zero.

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

Step-by-Step Process for Matrix Multiplication

To multiply two matrices, A and B, ensure that the number of columns in A equals the number of rows in B.

Calculate Elements: Multiply each element in a row of the first matrix by the corresponding element in a column of the second matrix, and sum these products to compute each element of the product matrix. Repeat this process for all rows and columns.

Form the Product Matrix: Place the computed elements in their respective positions to construct the resulting matrix.'

For example, let’s take a matrix of order (2×3) and another of order (3×2). To multiply these matrices, follow these steps:

Formula for Matrix Multiplication

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 Formula

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 X_{xy} = A_{x1}B_{y1} + .....+ A_{xb}B_{by} = Σ_{k= 1}^b A_{xk}B_{ky}

Matrix Multiplication (Scalar)

A matrix can be multiplied by a scalar value, which is called scalar 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]

Matrix Multiplication (2×2)

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]

Read in detail: How to Multiply 2 × 2 Matrices.

Matrix Multiplication (3×3)

Let us consider two matrices, P and a "3 × 3" matrix. 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]

Read in detail:

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

The programming 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

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

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.

Product with a Scalar

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

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

Articles related to Matrix Multiplication:

Algorithm for Matrix Multiplication

Various matrix multiplication algorithms 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 programming to find the multiplication of two matrices, such that the results are efficient and take less memory and time. They are used to find the 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 matrices is similar for any order of matrix for a particular algorithm.

Solved Question 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}, 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]

Practice Question on Matrix Multiplication

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

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

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

Question 4: Matrix Multiplication with Identity MatrixA = \begin{bmatrix}1 & 0 & 2 \\ -1 & 3 & 1\end{bmatrix}, \quad B = \begin{bmatrix}2 & -1 \\ 0 & 4 \\ 1 & 1\end{bmatrix}What is AI and IA?

More Questions on Matrix Multiplication - [Check here!]


Matrix Multiplication | Step-by-Step Guide, Rules, and Solved Examples

Similar Reads