mathpi.net

Matrix Subtraction Calculator

This Matrix Subtraction Calculator reads matrix size, then reads two matrices A and B of the specified size from user, and finds the difference of two matrices: (A - B), with step by step calculations.

Enter Matrix Size of A, B

×

Enter matrix A

The matrix appears when you enter the size: m, n.

Enter matrix B

The matrix appears when you enter the size: m, n.

How to do Matrix Subtraction

To perform matrix subtraction, follow these steps:

1. Ensure that the matrices you are given to add have the same dimensions.

2. Add the corresponding elements from each matrix to form a new matrix.

Subtraction of 2x2 Matrices

Consider two matrices A and B of dimension 2x2:

Matrix \({\ A = \begin{bmatrix}a11 & a12\\a21 & a22\end{bmatrix} }\)

Matrix \({\ B = \begin{bmatrix}b11 & b12\\b21 & b22\end{bmatrix} }\)

The result of the subtraction \({\ A - B }\) is a new matrix \({\ C }\).

Matrix \({\ C = \begin{bmatrix}c11 & c12\\c21 & c22\end{bmatrix} = A-B = \begin{bmatrix}a11 & a12\\a21 & a22\end{bmatrix} - \begin{bmatrix}b11 & b12\\b21 & b22\end{bmatrix} }\)

where each element \({\ cij = aij - bij }\).

\({\ C = \begin{bmatrix}c11 & c12\\c21 & c22\end{bmatrix} = \begin{bmatrix}a11 - b11 & a12 - b12\\a21 - b21 & a22 - b22\end{bmatrix} }\)

Subtraction of 3x3 Matrices

Consider two matrices A and B of dimension 3x3:

Matrix \({\ A = \begin{bmatrix}a11 & a12 & a13\\a21 & a22 &a23\\a31 & a32 &a33\end{bmatrix} }\)

Matrix \({\ B = \begin{bmatrix}b11 & b12 & b13\\b21 & b22 &b23\\b31 & b32 &b33\end{bmatrix} }\)

The result of adding A to B is a new matrix C.

Matrix \({\ C = \begin{bmatrix}c11 & c12 & c13\\c21 & c22 &c23\\c31 & c32 &c33\end{bmatrix} = \begin{bmatrix}a11 - b11 & a12 - b12 & a13 - b13\\a21 - b21 & a22 - b22 & a23 - b23\\a31 - b31 & a32 - b32 & a33 - b33\end{bmatrix} }\)

Examples for Matrix Subtraction

1. Find the subtraction of following two matrices: A - B.

Matrix \({\ A = \begin{bmatrix}7 & 2\\3 & 1\end{bmatrix} }\)

Matrix \({\ B = \begin{bmatrix}4 & 5\\4 & 0\end{bmatrix} }\)

Solution

Given matrices are:

Matrix \({\ A = \begin{bmatrix}7 & 2\\3 & 1\end{bmatrix} }\)

Matrix \({\ B = \begin{bmatrix}4 & 5\\4 & 0\end{bmatrix} }\)

Checking if Matrix Subtraction is possible with Matrices A and B

Both matrix A and matrix B are of same size: 2x2. Therefore, we can do the matrix subtraction with these two matrices.

Calculating Subtraction of Matrices A and B

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

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

\({\ A - B = \begin{bmatrix}3 & -3\\-1 & 1\end{bmatrix} }\)

Result of Matrix Subtraction

Therefore, the subtraction of the given two matrices A and B is

\({\ A - B = \begin{bmatrix}3 & -3\\-1 & 1\end{bmatrix} }\)

2. Find the subtraction of following two matrices: A - B.

Matrix \({\ A = \begin{bmatrix}1 & 2 & 3\\4 & 5 & 6\end{bmatrix} }\)

Matrix \({\ B = \begin{bmatrix}10 & 10 & 10\\10 & 10 & 10\end{bmatrix} }\)

Solution

Given matrices are:

Matrix \({\ A = \begin{bmatrix}1 & 2 & 3\\4 & 5 & 6\end{bmatrix} }\)

Matrix \({\ B = \begin{bmatrix}10 & 10 & 10\\10 & 10 & 10\end{bmatrix} }\)

Checking if Matrix Subtraction is possible with Matrices A and B

Both matrix A and matrix B are of same size: 2x3. Therefore, we can do the matrix subtraction with these two matrices.

Calculating Subtraction of Matrices A and B

\({\ A - B = \begin{bmatrix}1 & 2 & 3\\4 & 5 & 6\end{bmatrix} + \begin{bmatrix}10 & 10 & 10\\10 & 10 & 10\end{bmatrix} }\)

\({\ A - B = \begin{bmatrix}1-10 & 2-10 & 3-10\\4-10 & 5-10 & 6-10\end{bmatrix} }\)

\({\ A - B = \begin{bmatrix}-9 & -8 & -7\\-6 & -5 & -4\end{bmatrix} }\)

Result of Matrix Subtraction

Therefore, the subtraction of the given two matrices A and B is

\({\ A - B = \begin{bmatrix}-9 & -8 & -7\\-6 & -5 & -4\end{bmatrix} }\)

3. Find the subtraction of following two matrices: A - B.

Matrix \({\ A = \begin{bmatrix}1 & 2\\4 & 5\end{bmatrix} }\)

Matrix \({\ B = \begin{bmatrix}10 & 10 & 10\\10 & 10 & 10\end{bmatrix} }\)

Solution

Given matrices are:

Matrix \({\ A = \begin{bmatrix}1 & 2\\4 & 5 \end{bmatrix} }\)

Matrix \({\ B = \begin{bmatrix}10 & 10 & 10\\10 & 10 & 10\end{bmatrix} }\)

Checking if Matrix Subtraction is possible with Matrices A and B

Matrix A is of size 2x2, and matrix B is of same size: 2x3.

The given two matrices are of different size.

The condition for the two matrices to be of same size is not met, and the Matrix subtraction cannot be done for given matrices.