Source codeVideos

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

AB=A+(B)A - B = A + (-B)

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

Subtraction of Corresponding Elements

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

Each element cijc_{ij} of matrix CC is calculated by subtracting the corresponding element of matrix BB from the corresponding element of matrix AA:

cij=aijbijc_{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.

Example of Matrix Subtraction

Suppose we have two matrices, PP and QQ, as follows:

P=[8537]P = \begin{bmatrix} 8 & 5 \\ 3 & 7 \end{bmatrix}
Q=[2114]Q = \begin{bmatrix} 2 & 1 \\ -1 & 4 \end{bmatrix}

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

Using the method of subtracting corresponding elements:

PQ=[8537][2114]P - Q = \begin{bmatrix} 8 & 5 \\ 3 & 7 \end{bmatrix} - \begin{bmatrix} 2 & 1 \\ -1 & 4 \end{bmatrix}
=[82513(1)74]= \begin{bmatrix} 8-2 & 5-1 \\ 3-(-1) & 7-4 \end{bmatrix}
=[643+13]= \begin{bmatrix} 6 & 4 \\ 3+1 & 3 \end{bmatrix}
=[6443]= \begin{bmatrix} 6 & 4 \\ 4 & 3 \end{bmatrix}

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

First, determine Q-Q:

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

Then, add PP to Q-Q:

P+(Q)=[8537]+[2114]P + (-Q) = \begin{bmatrix} 8 & 5 \\ 3 & 7 \end{bmatrix} + \begin{bmatrix} -2 & -1 \\ 1 & -4 \end{bmatrix}
=[8+(2)5+(1)3+17+(4)]= \begin{bmatrix} 8+(-2) & 5+(-1) \\ 3+1 & 7+(-4) \end{bmatrix}
=[6443]= \begin{bmatrix} 6 & 4 \\ 4 & 3 \end{bmatrix}

Both methods yield the same matrix.

Example of Matrices That Cannot Be Subtracted

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

Matrix KK is of order 3×23 \times 2, while matrix LL is of order 2×22 \times 2. Since the orders of these two matrices are different, the subtraction KLK-L (or LKL-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 ABA - B is not equal to BAB - A, except in special cases (e.g., if A=BA=B).

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

    For example, from matrices PP and QQ above:

    PQ=[6443]P-Q = \begin{bmatrix} 6 & 4 \\ 4 & 3 \end{bmatrix}

    Whereas,

    QP=[2114][8537]Q-P = \begin{bmatrix} 2 & 1 \\ -1 & 4 \end{bmatrix} - \begin{bmatrix} 8 & 5 \\ 3 & 7 \end{bmatrix}
    =[28151347]= \begin{bmatrix} 2-8 & 1-5 \\ -1-3 & 4-7 \end{bmatrix}
    =[6443]= \begin{bmatrix} -6 & -4 \\ -4 & -3 \end{bmatrix}

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

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

    (AB)CA(BC)(in general)(A - B) - C \neq A - (B - C) \quad (\text{in general})

    This is because (AB)C=ABC(A - B) - C = A - B - C, whereas A(BC)=AB+CA - (B - C) = A - B + C.

The only "property" important to remember is its relationship with addition, i.e., AB=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=[420153]M = \begin{bmatrix} 4 & -2 & 0 \\ 1 & 5 & 3 \end{bmatrix}
N=[112607]N = \begin{bmatrix} -1 & 1 & -2 \\ 6 & 0 & 7 \end{bmatrix}

Determine the result of MNM-N.

Problem 2

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

[2x7y15][3z42x]=[51031]\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

Given three matrices:

A=[1001]A = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}
B=[3251]B = \begin{bmatrix} 3 & -2 \\ 5 & 1 \end{bmatrix}
C=[4023]C = \begin{bmatrix} -4 & 0 \\ 2 & -3 \end{bmatrix}

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

Answer Key

Problem 1

Given:

M=[420153]M = \begin{bmatrix} 4 & -2 & 0 \\ 1 & 5 & 3 \end{bmatrix}
N=[112607]N = \begin{bmatrix} -1 & 1 & -2 \\ 6 & 0 & 7 \end{bmatrix}

Then, MNM-N is:

MN=[420153][112607]M-N = \begin{bmatrix} 4 & -2 & 0 \\ 1 & 5 & 3 \end{bmatrix} - \begin{bmatrix} -1 & 1 & -2 \\ 6 & 0 & 7 \end{bmatrix}
=[4(1)210(2)165037]= \begin{bmatrix} 4-(-1) & -2-1 & 0-(-2) \\ 1-6 & 5-0 & 3-7 \end{bmatrix}
=[4+130+2554]= \begin{bmatrix} 4+1 & -3 & 0+2 \\ -5 & 5 & -4 \end{bmatrix}
=[532554]= \begin{bmatrix} 5 & -3 & 2 \\ -5 & 5 & -4 \end{bmatrix}

Problem 2

Given the matrix equation:

[2x7y15][3z42x]=[51031]\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:

[2x37z(y1)45(2x)]=[51031]\begin{bmatrix} 2x-3 & 7-z \\ (y-1)-4 & 5-(-2x) \end{bmatrix} = \begin{bmatrix} 5 & 10 \\ -3 & 1 \end{bmatrix}
[2x37zy55+2x]=[51031]\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: 2x3=52x-3 = 5

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

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

z=107-z = 10-7
z=3-z = 3
z=3z = -3

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

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

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

If we substitute x=4x=4 (from the first equation), we get 5+2(4)=135+2(4) = 13. Since 13113 \neq 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, z obtained from the first three consistent equations.

Thus, the values obtained are x=4x=4, y=2y=2, and z=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}
B=[3251]B = \begin{bmatrix} 3 & -2 \\ 5 & 1 \end{bmatrix}
C=[4023]C = \begin{bmatrix} -4 & 0 \\ 2 & -3 \end{bmatrix}

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

First, ABA-B:

AB=[1001][3251]A-B = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} - \begin{bmatrix} 3 & -2 \\ 5 & 1 \end{bmatrix}
=[130(2)0511]=[2250]= \begin{bmatrix} 1-3 & 0-(-2) \\ 0-5 & 1-1 \end{bmatrix} = \begin{bmatrix} -2 & 2 \\ -5 & 0 \end{bmatrix}

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

(AB)C=[2250][4023](A-B)-C = \begin{bmatrix} -2 & 2 \\ -5 & 0 \end{bmatrix} - \begin{bmatrix} -4 & 0 \\ 2 & -3 \end{bmatrix}
=[2(4)20520(3)]=[2+4270+3]=[2273]= \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(BC)A-(B-C):

First, BCB-C:

BC=[3251][4023]B-C = \begin{bmatrix} 3 & -2 \\ 5 & 1 \end{bmatrix} - \begin{bmatrix} -4 & 0 \\ 2 & -3 \end{bmatrix}
=[3(4)20521(3)]=[3+4231+3]=[7234]= \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(BC)A-(B-C):

A(BC)=[1001][7234]A-(B-C) = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} - \begin{bmatrix} 7 & -2 \\ 3 & 4 \end{bmatrix}
=[170(2)0314]=[6233]= \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: [2273][6233]\begin{bmatrix} 2 & 2 \\ -7 & 3 \end{bmatrix} \neq \begin{bmatrix} -6 & 2 \\ -3 & -3 \end{bmatrix}.

This shows that matrix subtraction is not associative.