• Nakafa

    Nakafa

    Learn free and with quality.
Subject
    • Grade 10
    • Grade 11
    • Grade 12
Exercises
Holy
  • Quran
Articles
  • Politics
  • Community
  • About

Command Palette

Search for a command to run...

Matrix

Matrix Subtraction

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 BBB from matrix AAA can be defined as the addition of matrix AAA with the opposite matrix of BBB (i.e., −B-B−B).

A−B=A+(−B)A - B = A + (-B)A−B=A+(−B)

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

Subtraction of Corresponding Elements

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

Each element cijc_{ij}cij​ of matrix CCC is calculated by subtracting the corresponding element of matrix BBB from the corresponding element of matrix AAA:

cij=aij−bijc_{ij} = a_{ij} - b_{ij}cij​=aij​−bij​

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.

Example of Matrix Subtraction

Suppose we have two matrices, PPP and QQQ, as follows:

P=[8537]P = \begin{bmatrix} 8 & 5 \\ 3 & 7 \end{bmatrix}P=[83​57​]
Q=[21−14]Q = \begin{bmatrix} 2 & 1 \\ -1 & 4 \end{bmatrix}Q=[2−1​14​]

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

Using the method of subtracting corresponding elements:

P−Q=[8537]−[21−14]P - Q = \begin{bmatrix} 8 & 5 \\ 3 & 7 \end{bmatrix} - \begin{bmatrix} 2 & 1 \\ -1 & 4 \end{bmatrix}P−Q=[83​57​]−[2−1​14​]
=[8−25−13−(−1)7−4]= \begin{bmatrix} 8-2 & 5-1 \\ 3-(-1) & 7-4 \end{bmatrix}=[8−23−(−1)​5−17−4​]
=[643+13]= \begin{bmatrix} 6 & 4 \\ 3+1 & 3 \end{bmatrix}=[63+1​43​]
=[6443]= \begin{bmatrix} 6 & 4 \\ 4 & 3 \end{bmatrix}=[64​43​]

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

First, determine −Q-Q−Q:

−Q=[−2−1−(−1)−4]=[−2−11−4]-Q = \begin{bmatrix} -2 & -1 \\ -(-1) & -4 \end{bmatrix} = \begin{bmatrix} -2 & -1 \\ 1 & -4 \end{bmatrix}−Q=[−2−(−1)​−1−4​]=[−21​−1−4​]

Then, add PPP to −Q-Q−Q:

P+(−Q)=[8537]+[−2−11−4]P + (-Q) = \begin{bmatrix} 8 & 5 \\ 3 & 7 \end{bmatrix} + \begin{bmatrix} -2 & -1 \\ 1 & -4 \end{bmatrix}P+(−Q)=[83​57​]+[−21​−1−4​]
=[8+(−2)5+(−1)3+17+(−4)]= \begin{bmatrix} 8+(-2) & 5+(-1) \\ 3+1 & 7+(-4) \end{bmatrix}=[8+(−2)3+1​5+(−1)7+(−4)​]
=[6443]= \begin{bmatrix} 6 & 4 \\ 4 & 3 \end{bmatrix}=[64​43​]

Both methods yield the same matrix.

Example of Matrices That Cannot Be Subtracted

Suppose matrix K=[10−2531]K = \begin{bmatrix} 1 & 0 \\ -2 & 5 \\ 3 & 1 \end{bmatrix}K=​1−23​051​​ and matrix L=[4207]L = \begin{bmatrix} 4 & 2 \\ 0 & 7 \end{bmatrix}L=[40​27​].

Matrix KKK is of order 3×23 \times 23×2, while matrix LLL is of order 2×22 \times 22×2. Since the orders of these two matrices are different, the subtraction K−LK-LK−L (or L−KL-KL−K) 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−BA - BA−B is not equal to B−AB - AB−A, except in special cases (e.g., if A=BA=BA=B).

    A−B≠B−A(in general)A - B \neq B - A \quad (\text{in general})A−B=B−A(in general)

    For example, from matrices PPP and QQQ above:

    P−Q=[6443]P-Q = \begin{bmatrix} 6 & 4 \\ 4 & 3 \end{bmatrix}P−Q=[64​43​]

    Whereas,

    Q−P=[21−14]−[8537]Q-P = \begin{bmatrix} 2 & 1 \\ -1 & 4 \end{bmatrix} - \begin{bmatrix} 8 & 5 \\ 3 & 7 \end{bmatrix}Q−P=[2−1​14​]−[83​57​]
    =[2−81−5−1−34−7]= \begin{bmatrix} 2-8 & 1-5 \\ -1-3 & 4-7 \end{bmatrix}=[2−8−1−3​1−54−7​]
    =[−6−4−4−3]= \begin{bmatrix} -6 & -4 \\ -4 & -3 \end{bmatrix}=[−6−4​−4−3​]

    It is clear that P−Q≠Q−PP-Q \neq Q-PP−Q=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(A - B) - C(A−B)−C is not equal to A−(B−C)A - (B - C)A−(B−C).

    (A−B)−C≠A−(B−C)(in general)(A - B) - C \neq A - (B - C) \quad (\text{in general})(A−B)−C=A−(B−C)(in general)

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

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

By converting the subtraction operation into addition with the opposite matrix, we can leverage the properties of addition if needed.

Exercises

Problem 1

Given the following matrices:

M=[4−20153]M = \begin{bmatrix} 4 & -2 & 0 \\ 1 & 5 & 3 \end{bmatrix}M=[41​−25​03​]
N=[−11−2607]N = \begin{bmatrix} -1 & 1 & -2 \\ 6 & 0 & 7 \end{bmatrix}N=[−16​10​−27​]

Determine the result of M−NM-NM−N.

Problem 2

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

[2x7y−15]−[3z4−2x]=[510−31]\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}[2xy−1​75​]−[34​z−2x​]=[5−3​101​]

Problem 3

Given three matrices:

A=[1001]A = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}A=[10​01​]
B=[3−251]B = \begin{bmatrix} 3 & -2 \\ 5 & 1 \end{bmatrix}B=[35​−21​]
C=[−402−3]C = \begin{bmatrix} -4 & 0 \\ 2 & -3 \end{bmatrix}C=[−42​0−3​]

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

Answer Key

Problem 1

Given:

M=[4−20153]M = \begin{bmatrix} 4 & -2 & 0 \\ 1 & 5 & 3 \end{bmatrix}M=[41​−25​03​]
N=[−11−2607]N = \begin{bmatrix} -1 & 1 & -2 \\ 6 & 0 & 7 \end{bmatrix}N=[−16​10​−27​]

Then, M−NM-NM−N is:

M−N=[4−20153]−[−11−2607]M-N = \begin{bmatrix} 4 & -2 & 0 \\ 1 & 5 & 3 \end{bmatrix} - \begin{bmatrix} -1 & 1 & -2 \\ 6 & 0 & 7 \end{bmatrix}M−N=[41​−25​03​]−[−16​10​−27​]
=[4−(−1)−2−10−(−2)1−65−03−7]= \begin{bmatrix} 4-(-1) & -2-1 & 0-(-2) \\ 1-6 & 5-0 & 3-7 \end{bmatrix}=[4−(−1)1−6​−2−15−0​0−(−2)3−7​]
=[4+1−30+2−55−4]= \begin{bmatrix} 4+1 & -3 & 0+2 \\ -5 & 5 & -4 \end{bmatrix}=[4+1−5​−35​0+2−4​]
=[5−32−55−4]= \begin{bmatrix} 5 & -3 & 2 \\ -5 & 5 & -4 \end{bmatrix}=[5−5​−35​2−4​]

Problem 2

Given the matrix equation:

[2x7y−15]−[3z4−2x]=[510−31]\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}[2xy−1​75​]−[34​z−2x​]=[5−3​101​]

Perform the subtraction operation on the left side:

[2x−37−z(y−1)−45−(−2x)]=[510−31]\begin{bmatrix} 2x-3 & 7-z \\ (y-1)-4 & 5-(-2x) \end{bmatrix} = \begin{bmatrix} 5 & 10 \\ -3 & 1 \end{bmatrix}[2x−3(y−1)−4​7−z5−(−2x)​]=[5−3​101​]
[2x−37−zy−55+2x]=[510−31]\begin{bmatrix} 2x-3 & 7-z \\ y-5 & 5+2x \end{bmatrix} = \begin{bmatrix} 5 & 10 \\ -3 & 1 \end{bmatrix}[2x−3y−5​7−z5+2x​]=[5−3​101​]

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

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

2x=5+32x = 5+32x=5+3
2x=82x = 82x=8
x=4x = 4x=4

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

−z=10−7-z = 10-7−z=10−7
−z=3-z = 3−z=3
z=−3z = -3z=−3

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

y=−3+5y = -3+5y=−3+5
y=2y = 2y=2

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

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

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

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

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

Problem 3

Given:

A=[1001]A = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}A=[10​01​]
B=[3−251]B = \begin{bmatrix} 3 & -2 \\ 5 & 1 \end{bmatrix}B=[35​−21​]
C=[−402−3]C = \begin{bmatrix} -4 & 0 \\ 2 & -3 \end{bmatrix}C=[−42​0−3​]

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

First, A−BA-BA−B:

A−B=[1001]−[3−251]A-B = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} - \begin{bmatrix} 3 & -2 \\ 5 & 1 \end{bmatrix}A−B=[10​01​]−[35​−21​]
=[1−30−(−2)0−51−1]=[−22−50]= \begin{bmatrix} 1-3 & 0-(-2) \\ 0-5 & 1-1 \end{bmatrix} = \begin{bmatrix} -2 & 2 \\ -5 & 0 \end{bmatrix}=[1−30−5​0−(−2)1−1​]=[−2−5​20​]

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

(A−B)−C=[−22−50]−[−402−3](A-B)-C = \begin{bmatrix} -2 & 2 \\ -5 & 0 \end{bmatrix} - \begin{bmatrix} -4 & 0 \\ 2 & -3 \end{bmatrix}(A−B)−C=[−2−5​20​]−[−42​0−3​]
=[−2−(−4)2−0−5−20−(−3)]=[−2+42−70+3]=[22−73]= \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}=[−2−(−4)−5−2​2−00−(−3)​]=[−2+4−7​20+3​]=[2−7​23​]

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

First, B−CB-CB−C:

B−C=[3−251]−[−402−3]B-C = \begin{bmatrix} 3 & -2 \\ 5 & 1 \end{bmatrix} - \begin{bmatrix} -4 & 0 \\ 2 & -3 \end{bmatrix}B−C=[35​−21​]−[−42​0−3​]
=[3−(−4)−2−05−21−(−3)]=[3+4−231+3]=[7−234]= \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}=[3−(−4)5−2​−2−01−(−3)​]=[3+43​−21+3​]=[73​−24​]

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

A−(B−C)=[1001]−[7−234]A-(B-C) = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} - \begin{bmatrix} 7 & -2 \\ 3 & 4 \end{bmatrix}A−(B−C)=[10​01​]−[73​−24​]
=[1−70−(−2)0−31−4]=[−62−3−3]= \begin{bmatrix} 1-7 & 0-(-2) \\ 0-3 & 1-4 \end{bmatrix} = \begin{bmatrix} -6 & 2 \\ -3 & -3 \end{bmatrix}=[1−70−3​0−(−2)1−4​]=[−6−3​2−3​]

The results are not the same: [22−73]≠[−62−3−3]\begin{bmatrix} 2 & 2 \\ -7 & 3 \end{bmatrix} \neq \begin{bmatrix} -6 & 2 \\ -3 & -3 \end{bmatrix}[2−7​23​]=[−6−3​2−3​].

This shows that matrix subtraction is not associative.

Previous

Matrix Addition

Next

Matrix Scalar Multiplication

  • Matrix SubtractionLearn matrix subtraction with step-by-step examples, properties, and practice problems. Master subtracting corresponding elements and matrix operations.
On this page
  • What Is Matrix Subtraction?
  • Formal Definition of Matrix Subtraction
  • How to Perform Matrix Subtraction
    • Example of Matrix Subtraction
    • Example of Matrices That Cannot Be Subtracted
  • Properties of Matrix Subtraction
  • Exercises
    • Answer Key
  • Comments
  • Report
  • Source code