# Nakafa Learning Content

> For AI agents: use [llms.txt](https://nakafa.com/llms.txt) for the site index. Markdown versions are available by appending `.md` to content URLs or sending `Accept: text/markdown`.

URL: https://nakafa.com/en/subjects/mathematics/matrix/matrix-subtraction
Source: https://raw.githubusercontent.com/nakafaai/nakafa.com/refs/heads/main/packages/contents/material/lesson/mathematics/matrix/matrix-subtraction/en.mdx

Learn matrix subtraction with worked examples, properties, and practice problems. Learn subtracting corresponding elements and matrix operations.

---

## What Is Matrix Subtraction?

Matrix subtraction is an operation to find the difference between two matrices. Just like matrix addition, the subtraction operation can only be performed if both matrices involved have the same size or order.

The result of matrix subtraction is a new matrix that also has the same order, where each element is the result of subtracting the corresponding elements from the two initial matrices.

## Formal Definition of Matrix Subtraction

There are two common ways to define matrix subtraction, both of which lead to the same result.

**Subtraction as Addition with the Opposite**

The subtraction of matrix $$B$$ from matrix $$A$$ can be defined as the addition of matrix $$A$$ with the opposite matrix of $$B$$ (i.e., $$-B$$).

Visible text: The subtraction of matrix from matrix can be defined as the addition of matrix with the opposite matrix of (i.e., ).

```math
A - B = A + (-B)
```

Matrix $$-B$$ is the matrix obtained by multiplying each element of matrix $$B$$ by $$-1$$. So, if $$B = [b_{ij}]$$, then $$-B = [-b_{ij}]$$.

Visible text: Matrix is the matrix obtained by multiplying each element of matrix by . So, if , then .

**Subtraction of Corresponding Elements**

If matrix $$A = [a_{ij}]$$ and matrix $$B = [b_{ij}]$$ both have the order $$m \times n$$, then the result of the subtraction $$C = A - B$$ will also be of order $$m \times n$$.

Visible text: If matrix and matrix both have the order , then the result of the subtraction will also be of order .

Each element $$c_{ij}$$ of matrix $$C$$ is calculated by subtracting the corresponding element of matrix $$B$$ from the corresponding element of matrix $$A$$:

Visible text: Each element of matrix is calculated by subtracting the corresponding element of matrix from the corresponding element of matrix :

```math
c_{ij} = a_{ij} - b_{ij}
```

This means we subtract the elements that are in the same row and column position.

Both definitions are equivalent and will produce the same difference matrix.

## How to Perform Matrix Subtraction

To subtract two matrices, follow these steps:

1.  **Ensure Same Order**: The first and most important step is to check if both matrices have the same number of rows and columns. If their orders are different, subtraction cannot be performed.
2.  **Subtract Corresponding Elements**: If the orders are the same, subtract each element of the second matrix (subtrahend) from the corresponding element of the first matrix.
3.  **Form the Resultant Matrix**: Arrange the results of these subtractions into a new matrix. This new matrix will have the same order as the initial matrices.

Visible text: 1. **Ensure Same Order**: The first and most important step is to check if both matrices have the same number of rows and columns. If their orders are different, subtraction cannot be performed.
2. **Subtract Corresponding Elements**: If the orders are the same, subtract each element of the second matrix (subtrahend) from the corresponding element of the first matrix.
3. **Form the Resultant Matrix**: Arrange the results of these subtractions into a new matrix. This new matrix will have the same order as the initial matrices.

### Example of Matrix Subtraction

Suppose we have two matrices, $$P$$ and $$Q$$, as follows:

Visible text: Suppose we have two matrices, and , as follows:

Component: MathContainer
Children:

```math
P = \begin{bmatrix} 8 & 5 \\ 3 & 7 \end{bmatrix}
```

```math
Q = \begin{bmatrix} 2 & 1 \\ -1 & 4 \end{bmatrix}
```

Both matrices are of order $$2 \times 2$$, so they can be subtracted.

Visible text: Both matrices are of order , so they can be subtracted.

Using the method of subtracting corresponding elements:

Component: MathContainer
Children:

```math
P - Q = \begin{bmatrix} 8 & 5 \\ 3 & 7 \end{bmatrix} - \begin{bmatrix} 2 & 1 \\ -1 & 4 \end{bmatrix}
```

```math
= \begin{bmatrix} 8-2 & 5-1 \\ 3-(-1) & 7-4 \end{bmatrix}
```

```math
= \begin{bmatrix} 6 & 4 \\ 3+1 & 3 \end{bmatrix}
```

```math
= \begin{bmatrix} 6 & 4 \\ 4 & 3 \end{bmatrix}
```

Using the method of addition with the opposite ($$P + (-Q)$$):

Visible text: Using the method of addition with the opposite ():

First, determine $$-Q$$:

Visible text: First, determine :

```math
-Q = \begin{bmatrix} -2 & -1 \\ -(-1) & -4 \end{bmatrix} = \begin{bmatrix} -2 & -1 \\ 1 & -4 \end{bmatrix}
```

Then, add $$P$$ to $$-Q$$:

Visible text: Then, add to :

Component: MathContainer
Children:

```math
P + (-Q) = \begin{bmatrix} 8 & 5 \\ 3 & 7 \end{bmatrix} + \begin{bmatrix} -2 & -1 \\ 1 & -4 \end{bmatrix}
```

```math
= \begin{bmatrix} 8+(-2) & 5+(-1) \\ 3+1 & 7+(-4) \end{bmatrix}
```

```math
= \begin{bmatrix} 6 & 4 \\ 4 & 3 \end{bmatrix}
```

Both methods yield the same matrix.

### Example of Matrices That Cannot Be Subtracted

Suppose matrix $$K = \begin{bmatrix} 1 & 0 \\ -2 & 5 \\ 3 & 1 \end{bmatrix}$$ and matrix $$L = \begin{bmatrix} 4 & 2 \\ 0 & 7 \end{bmatrix}$$.

Visible text: Suppose matrix and matrix .

Matrix $$K$$ is of order $$3 \times 2$$, while matrix $$L$$ is of order $$2 \times 2$$. Since the orders of these two matrices are different, the subtraction $$K-L$$ (or $$L-K$$) cannot be performed or is undefined.

Visible text: Matrix is of order , while matrix is of order . Since the orders of these two matrices are different, the subtraction (or ) cannot be performed or is undefined.

## Properties of Matrix Subtraction

Unlike matrix addition, which has several important properties like commutativity and associativity, matrix subtraction generally does not possess these properties.

1.  **Not Commutative**: In general, the order of matrix subtraction significantly affects the result. This means $$A - B$$ is not equal to $$B - A$$, except in special cases (e.g., if $$A=B$$).

    
    
    ```math
    A - B \neq B - A \quad (\text{in general})
    ```

    For example, from matrices $$P$$ and $$Q$$ above:

    $$P-Q = \begin{bmatrix} 6 & 4 \\ 4 & 3 \end{bmatrix}$$

    Whereas,

    <MathContainer>
      
    
    ```math
    Q-P = \begin{bmatrix} 2 & 1 \\ -1 & 4 \end{bmatrix} - \begin{bmatrix} 8 & 5 \\ 3 & 7 \end{bmatrix}
    ```

      
    
    ```math
    = \begin{bmatrix} 2-8 & 1-5 \\ -1-3 & 4-7 \end{bmatrix}
    ```

      
    
    ```math
    = \begin{bmatrix} -6 & -4 \\ -4 & -3 \end{bmatrix}
    ```

    </MathContainer>

    It is clear that $$P-Q \neq Q-P$$.

2.  **Not Associative**: The grouping in the subtraction of three or more matrices also affects the final result. In general, $$(A - B) - C$$ is not equal to $$A - (B - C)$$.

    
    
    ```math
    (A - B) - C \neq A - (B - C) \quad (\text{in general})
    ```

    This is because $$(A - B) - C = A - B - C$$, whereas $$A - (B - C) = A - B + C$$.

Visible text: 1. **Not Commutative**: In general, the order of matrix subtraction significantly affects the result. This means is not equal to , except in special cases (e.g., if ).

 
 

 For example, from matrices and above:

 

 Whereas,

 <MathContainer>
 
 

 
 

 
 

 </MathContainer>

 It is clear that .

2. **Not Associative**: The grouping in the subtraction of three or more matrices also affects the final result. In general, is not equal to .

 
 

 This is because , whereas .

The only "property" important to remember is its relationship with addition, i.e., $$A - B = A + (-B)$$.

Visible text: The only "property" important to remember is its relationship with addition, i.e., .

By converting subtraction into addition with the opposite matrix, we can use addition properties when needed.

## Exercises

**Problem** $$1$$

Visible text: **Problem**

Given the following matrices:

Component: MathContainer
Children:

```math
M = \begin{bmatrix} 4 & -2 & 0 \\ 1 & 5 & 3 \end{bmatrix}
```

```math
N = \begin{bmatrix} -1 & 1 & -2 \\ 6 & 0 & 7 \end{bmatrix}
```

Determine the result of $$M-N$$.

Visible text: Determine the result of .

**Problem** $$2$$

Visible text: **Problem**

Determine the values of $$x, y,$$ and $$z$$ from the following matrix equation:

Visible text: Determine the values of and from the following matrix equation:

```math
\begin{bmatrix} 2x & 7 \\ y-1 & 5 \end{bmatrix} - \begin{bmatrix} 3 & z \\ 4 & -2x \end{bmatrix} = \begin{bmatrix} 5 & 10 \\ -3 & 1 \end{bmatrix}
```

**Problem** $$3$$

Visible text: **Problem**

Given three matrices:

Component: MathContainer
Children:

```math
A = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}
```

```math
B = \begin{bmatrix} 3 & -2 \\ 5 & 1 \end{bmatrix}
```

```math
C = \begin{bmatrix} -4 & 0 \\ 2 & -3 \end{bmatrix}
```

Calculate $$(A-B)-C$$ and $$A-(B-C)$$. Are the results the same?

Visible text: Calculate and . Are the results the same?

### Answer Key

**Problem** $$1$$

Visible text: **Problem**

Given:

Component: MathContainer
Children:

```math
M = \begin{bmatrix} 4 & -2 & 0 \\ 1 & 5 & 3 \end{bmatrix}
```

```math
N = \begin{bmatrix} -1 & 1 & -2 \\ 6 & 0 & 7 \end{bmatrix}
```

Then, $$M-N$$ is:

Visible text: Then, is:

Component: MathContainer
Children:

```math
M-N = \begin{bmatrix} 4 & -2 & 0 \\ 1 & 5 & 3 \end{bmatrix} - \begin{bmatrix} -1 & 1 & -2 \\ 6 & 0 & 7 \end{bmatrix}
```

```math
= \begin{bmatrix} 4-(-1) & -2-1 & 0-(-2) \\ 1-6 & 5-0 & 3-7 \end{bmatrix}
```

```math
= \begin{bmatrix} 4+1 & -3 & 0+2 \\ -5 & 5 & -4 \end{bmatrix}
```

```math
= \begin{bmatrix} 5 & -3 & 2 \\ -5 & 5 & -4 \end{bmatrix}
```

**Problem** $$2$$

Visible text: **Problem**

Given the matrix equation:

```math
\begin{bmatrix} 2x & 7 \\ y-1 & 5 \end{bmatrix} - \begin{bmatrix} 3 & z \\ 4 & -2x \end{bmatrix} = \begin{bmatrix} 5 & 10 \\ -3 & 1 \end{bmatrix}
```

Perform the subtraction operation on the left side:

Component: MathContainer
Children:

```math
\begin{bmatrix} 2x-3 & 7-z \\ (y-1)-4 & 5-(-2x) \end{bmatrix} = \begin{bmatrix} 5 & 10 \\ -3 & 1 \end{bmatrix}
```

```math
\begin{bmatrix} 2x-3 & 7-z \\ y-5 & 5+2x \end{bmatrix} = \begin{bmatrix} 5 & 10 \\ -3 & 1 \end{bmatrix}
```

Based on the equality of two matrices, corresponding elements must be equal:

From the element in row $$1$$, column $$1$$: $$2x-3 = 5$$

Visible text: From the element in row , column :

Component: MathContainer
Children:

```math
2x = 5+3
```

```math
2x = 8
```

```math
x = 4
```

From the element in row $$1$$, column $$2$$: $$7-z = 10$$

Visible text: From the element in row , column :

Component: MathContainer
Children:

```math
-z = 10-7
```

```math
-z = 3
```

```math
z = -3
```

From the element in row $$2$$, column $$1$$: $$y-5 = -3$$

Visible text: From the element in row , column :

Component: MathContainer
Children:

```math
y = -3+5
```

```math
y = 2
```

From the element in row $$2$$, column $$2$$: $$5+2x = 1$$.

Visible text: From the element in row , column : .

If we substitute $$x=4$$ (from the first equation), we get $$5+2(4) = 13$$. Since $$13 \neq 1$$, there is an inconsistency in the last element of this problem.

Visible text: If we substitute (from the first equation), we get . Since , there is an inconsistency in the last element of this problem.

For learning purposes, we will use the values of $$x, y, z$$ obtained from the first three consistent equations.

Visible text: For learning purposes, we will use the values of obtained from the first three consistent equations.

Thus, the values obtained are $$x=4$$, $$y=2$$, and $$z=-3$$.

Visible text: Thus, the values obtained are , , and .

In an exam situation, such inconsistencies should be confirmed with the examiner.

**Problem** $$3$$

Visible text: **Problem**

Given:

Component: MathContainer
Children:

```math
A = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}
```

```math
B = \begin{bmatrix} 3 & -2 \\ 5 & 1 \end{bmatrix}
```

```math
C = \begin{bmatrix} -4 & 0 \\ 2 & -3 \end{bmatrix}
```

Calculate $$(A-B)-C$$:

Visible text: Calculate :

First, $$A-B$$:

Visible text: First, :

Component: MathContainer
Children:

```math
A-B = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} - \begin{bmatrix} 3 & -2 \\ 5 & 1 \end{bmatrix}
```

```math
= \begin{bmatrix} 1-3 & 0-(-2) \\ 0-5 & 1-1 \end{bmatrix} = \begin{bmatrix} -2 & 2 \\ -5 & 0 \end{bmatrix}
```

Then, $$(A-B)-C$$:

Visible text: Then, :

Component: MathContainer
Children:

```math
(A-B)-C = \begin{bmatrix} -2 & 2 \\ -5 & 0 \end{bmatrix} - \begin{bmatrix} -4 & 0 \\ 2 & -3 \end{bmatrix}
```

```math
= \begin{bmatrix} -2-(-4) & 2-0 \\ -5-2 & 0-(-3) \end{bmatrix} = \begin{bmatrix} -2+4 & 2 \\ -7 & 0+3 \end{bmatrix} = \begin{bmatrix} 2 & 2 \\ -7 & 3 \end{bmatrix}
```

Calculate $$A-(B-C)$$:

Visible text: Calculate :

First, $$B-C$$:

Visible text: First, :

Component: MathContainer
Children:

```math
B-C = \begin{bmatrix} 3 & -2 \\ 5 & 1 \end{bmatrix} - \begin{bmatrix} -4 & 0 \\ 2 & -3 \end{bmatrix}
```

```math
= \begin{bmatrix} 3-(-4) & -2-0 \\ 5-2 & 1-(-3) \end{bmatrix} = \begin{bmatrix} 3+4 & -2 \\ 3 & 1+3 \end{bmatrix} = \begin{bmatrix} 7 & -2 \\ 3 & 4 \end{bmatrix}
```

Then, $$A-(B-C)$$:

Visible text: Then, :

Component: MathContainer
Children:

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

```math
= \begin{bmatrix} 1-7 & 0-(-2) \\ 0-3 & 1-4 \end{bmatrix} = \begin{bmatrix} -6 & 2 \\ -3 & -3 \end{bmatrix}
```

The results are not the same: $$\begin{bmatrix} 2 & 2 \\ -7 & 3 \end{bmatrix} \neq \begin{bmatrix} -6 & 2 \\ -3 & -3 \end{bmatrix}$$.

Visible text: The results are not the same: .

This shows that matrix subtraction is not associative.