Matrix Subtraction

In the previous post, you have learned about matrix addition and its mathematical properties. The matrix subtraction is also mathematical operation on two matrices where elements of right hand matrix is subtract from elements of matrix on the left hand. The result is stored in a separate third matrix.

Advertisements

Condition To Subtract Matrices

Similar to matrix addition, there are few conditions for matrix subtraction. The minuend matrix should be on the left hand side and subtrahend matrix on the right The result of the subtraction must be stored in a difference matrix. The size of all three matrices must be same.

\begin{aligned}
&\hspace{5px}A - B = C\\\\
&=\begin{bmatrix} a_{11} & a_{12} & a_{13}\\a_{21} & a_{22} & a_{23}\\a_{31} & a_{32} & a_{33}\end{bmatrix}  - \begin{bmatrix} b_{11} & b_{12} & b_{13}\\b_{21} & b_{22} & b_{23}\\b_{31} & b_{32} & b_{33}\end{bmatrix}\\\\
& =\begin{bmatrix} a_{11}- b_{11} & a_{12}- b_{12} & a_{13}- b_{13}\\a_{21}-b_{21} & a_{22}-b_{22} & a_{23}- b_{23}\\a_{31} - b_{31}& a_{32} - b_{32} & a_{33} - b_{33}\end{bmatrix}\\\\
&C =\begin{bmatrix} c_{11} & c_{12} & c_{13}\\c_{21} & c_{22} & c_{23}\\c_{31} & c_{32} & c_{33}\end{bmatrix}
\end{aligned}

The matrix $A$ is minuend and matrix $B$ is subtrahend. The difference is stored in the matrix $C$.

Mathematical Properties of Matrix Subtraction

The properties of matrix addition such as commutative, associative , scalar multiplication, also applies to subtraction, in other words, the elements of both matrix are performing addition, but one or more elements happen to be negative number.

Advertisements

For example, another way to look at the matrix subtraction is as follows where $A$ and $B$ are two matrices.

\begin{aligned}
A - B = A + (-1 * B ) = C
\end{aligned}

The above equation will yield same results.

Example

In this example, we will subtract matrix $B$ from matrix $A$ and keep the difference in matrix $C$.

\begin{aligned}
&A - B = C\\\\
&=\begin{bmatrix} 5 & 4 & 3\\1 & 2 & 3\\9 & 8 & 7\end{bmatrix} - \begin{bmatrix} 2 & 1 & 0\\1 & 1 & 1\\2 & 4 & 5\end{bmatrix}\\\\
&=\begin{bmatrix} 5 - 2 & 4 - 1 & 3 - 0\\1 - 1 & 2 - 1 & 3 - 1\\9 - 2 & 8 - 4 & 7 - 5\end{bmatrix}\\\\
&C =\begin{bmatrix} 3 & 3 & 3\\0 & 1 & 2\\7 & 4 & 2\end{bmatrix}
\end{aligned}

Though the above example shows positive elements, its not always true and one must careful while subtracting from a negative numbers as the sign must change.

Advertisements

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.