The Wayback Machine - https://web.archive.org/web/20250317191548/https://www.geeksforgeeks.org/subtraction-of-matrices/
Open In App

Subtraction of Matrices

Last Updated : 03 Jan, 2025
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Share
Report
News Follow

Subtraction of matrices is the addition of the negative of a matrix to another matrix which means A - B = A + (-B). The subtraction of the matrix is subtracting the corresponding row-column element of one matrix with the same row-column element of another matrix.

Matrix subtraction is an operation where corresponding elements of two matrices are subtracted from each other to form a new matrix. This operation is similar to matrix addition, but instead of adding the corresponding elements, they are subtracted.

Subtraction-of-Matrices
Matrix Subtraction

For two matrices to be subtracted, they must have the same dimensions, meaning they must have the same number of rows and columns. If A and B are two matrices of the same dimensions, their subtraction is denoted as A − B.

Notation of Matrix Subtraction

Given two matrices A and B of the same size, the matrix subtraction A−B is defined as:

(A − B)ij ​= Aij​ − Bij​

Where Aij​ and Bij​ are the elements of matrices A and B at the ith row and jth column, respectively.

Condition for Matrix Subtraction

For matrix subtraction to be defined and valid, the following condition must be satisfied:

The two matrices must have the same dimensions, meaning they must have the same number of rows and the same number of columns.

Subtraction of n × n Matrices

The subtraction of n × n matrices includes subtracting each row column (i, j) element of one matrix with the corresponding row column (i, j) element of other matrix.

Consider matrix P = \bold{\begin{bmatrix} p_{11} & p_{12} & \cdots & p_{1n} \\ p_{21} & p_{22} & \cdots & p_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ p_{n1} & p_{n2} & \cdots & p_{nn} \end{bmatrix}} and Q = \bold{\begin{bmatrix} q_{11} & q_{12} & \cdots & q_{1n} \\ q_{21} & q_{22} & \cdots & q_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ q_{n1} & q_{n2} & \cdots & q_{nn} \end{bmatrix}}

P - Q = \begin{bmatrix}p_{11}-q_{11} &p_{12}-q_{12}& ... & p_{1n}-q_{1n} \\p_{21}-q_{21} &p_{22}-q_{22}&... & p_{2n}-q_{2n} \\ \vdots & \vdots &\ddots &\vdots \\p_{n1}-q_{n1}&p_{n2}-q_{n2}&...&p_{nn}-q_{nn}\end{bmatrix}

Subtraction of 2 × 2 Matrices

The subtraction of 2 × 2 matrices includes subtracting each row column (i, j) element of one matrix with corresponding row column (i, j) element of the other matrix.

Consider matrix X = \begin{bmatrix}x_{11} &x_{12}\\x_{21} & x_{22}\end{bmatrix} and Y = \begin{bmatrix}y_{11} & y_{12}\\y_{21} & y_{22}\end{bmatrix}

X - Y = \begin{bmatrix}x_{11}- y_{11}& x_{12} - y_{12}\\x_{21}-y_{21} & x_{22} - y_{22}\end{bmatrix}

Subtraction of 3 × 3 Matrices

The subtraction of 3 × 3 matrices includes subtracting each row column (i, j) element of one matrix with corresponding row column (i, j) element of other matrix.

Consider matrix X = \begin{bmatrix}x_{11} & x_{12}&x_{13}\\x_{21} & x_{22}&x_{23}\\x_{31} & x_{32}&x_{33}\end{bmatrix} and Y = \begin{bmatrix}y_{11} & y_{12}&y_{13}\\y_{21} & y_{22}&y_{23}\\y_{21} &y_{22}&y_{23}\\\end{bmatrix}

X - Y = \begin{bmatrix}x_{11}- y_{11}& x_{12} - y_{12}& x_{13} - y_{13}\\x_{21}-y_{21} & x_{22} - y_{22}& x_{23} - y_{23}\\x_{31}-y_{31} & x_{32} - y_{32}&x_{33} - y_{33}\end{bmatrix}

Read More,

Solved Examples of Subtraction of Matrices

Example 1: Q1. Subtract the matrices: P = \begin{bmatrix}15 & 4\\13 & 9\end{bmatrix} and Q = \begin{bmatrix}1 & -13\\6 & 0\end{bmatrix}

Solution:

P - Q = \begin{bmatrix}15 & 4\\13 & 9\end{bmatrix} - \begin{bmatrix}1 & -13\\6 & 0\end{bmatrix}

P - Q = \begin{bmatrix}15-1 & 4-(-13)\\13- 6 & 9-0\end{bmatrix}

P - Q = \begin{bmatrix}14 & 17\\7 & 9\end{bmatrix}

Example 2: Subtract the matrices A = \begin{bmatrix} -8& 3& 9\\-1 & 2&6\\ 5&-12&4\end{bmatrix} and B = \begin{bmatrix} -3& 5& 13\\-10 &23&0\\ 7&-1&22\end{bmatrix}

Solution:

A - B = \begin{bmatrix} -8& 3& 9\\-1 & 2&6\\ 5& -12&4\end{bmatrix} - \begin{bmatrix} -3&5& 13\\-10 & 23&0\\ 7& -1&22\end{bmatrix}

A - B = \begin{bmatrix}-8-( -3)&3-5& 9-13\\-1-(-10) & 2-23&6-0\\ 5-7& -12-(-1)&4 -22\end{bmatrix}

A - B = \begin{bmatrix}-5& -2& -4\\9 & -21&6\\ -2& -11& -18\end{bmatrix}

Example 3: Compute R - S where R = \begin{bmatrix} -2& 5& 1&10\\-3 & 7&-1&8\\ 6& -10&0&-4\end{bmatrix} and S = \begin{bmatrix} 8 &4& -3&0\\-5 & -2&7&12\\ 0& 1&-2 &9\end{bmatrix}

Solution:

R - S = \begin{bmatrix} -2& 5& 1&10\\-3 & 7&-1&8\\ 6& -10&0&-4\end{bmatrix} - \begin{bmatrix} 8&4& -3&0\\-5 & -2&7&12\\ 0& 1&-2&9\end{bmatrix}

R - S = \begin{bmatrix} -2-8&5-4& 1-(-3)&10-0\\-3-(-5) & 7-(-2)&-1-7&8-12\\ 6-0& -10-1&0-(-2)&4-9\end{bmatrix}

R - S = \begin{bmatrix} -10& 1& 4&10\\2 & 9&-8&-4\\ 6& -11&2&-5\end{bmatrix}

Example 4: Subtract the matrices C = \begin{bmatrix} -1& 3 \\0 & 2\\\end{bmatrix} and D = \begin{bmatrix} 1& 3& 2\\4 & 5&9\\ 6& 10&11\end{bmatrix}

Solution:

Order of C = 2 × 2 and Order of D = 3 × 3

Order of C ≠ Order of D

So, subtraction cannot be performed in the given matrices as the order of the given matrices are different and subtraction can only be performed on order of same matrices.

Practice Questions on Subtraction of Matrices

Question 1: Subtract the matrices: P = \begin{bmatrix}5 & 9\\2 & 4\end{bmatrix} and Q = \begin{bmatrix}0 & -3\\7 &14\end{bmatrix}

Question 2: Subtract the matrices A = \begin{bmatrix} -8& 3& 9\\-1 & 2&6\\ 5& -12&4\end{bmatrix} and B = \begin{bmatrix} -3& 5& 13\\-10 &23&0\\ 7& -1&22\end{bmatrix}

Question 3: Compute R - S where R = \begin{bmatrix} -8& 3& 9&10\\-1 & 2&6&2\\ 5& -12&4&7\end{bmatrix} and S = \begin{bmatrix} 1& 6& 3&0\\-1 & -2&-8&2\\ 0& 5&4&-7\end{bmatrix}

Question 4: Subtract the matrices C = \begin{bmatrix} -18& 30 \\-10 & 21\\\end{bmatrix} and D = \begin{bmatrix} -1& 3& 12\\-2 & 4&6\\ 5& -3&14\end{bmatrix}

Answer key

Answer 1: \begin{bmatrix}5 & 12\\-5 & -10\end{bmatrix}
Answer 2: \begin{bmatrix}-5 & -2 &-4\\9 & -21 & 6\\ -2&-11&-18\end{bmatrix}
Answer 3: \begin{bmatrix} -9& -3& 6&10\\0 & 4&14&0\\ 5& -17&0&14\end{bmatrix}
Answer 4: Since the matrices have different dimensions, matrix subtraction is not defined between them.

FAQs on Subtraction of Matrices

What are the Rules for Subtracting Matrices?

The rules for subtracting matrices are:

  • The matrices should be of equal dimensions.
  • Each element of one matrix should be subtracted from corresponding element of other matrix.

Can You Subtract a 2 × 2 Matrix from a 3 × 3 Matrix?

No, we cannot subtract 2 × 2 matrix from a 3 × 3 matrix as dimensions are not same.

How to Do Subtraction of Two Matrices?

To subtract two matrices, we subtract xij element of first matrix with yij of second matrix. This process is done for all the elements of the matrices.

Is Matrix Subtraction Associative?

No, matrix subtraction is not associative.

Is Matrix Subtraction Commutative?

No, matrix subtraction is not commutative.


Similar Reads

three90RightbarBannerImg