Addition and subtraction of matrices

Addition and Subtraction of two Matrices #

Two matrices can be added or subtracted if their orders are same i.e. their number of rows and columns must match.

The order of the resulting matrix will also be same as operands’ order.

Matrices of different orders cannot be added or subtracted

The process of addition and subtraction of two matrices is very straightforward. Take the corresponding entries from the two matrices and perform the operation.

For example if matrices A and B are of same order and matrix C is the result: \[\begin{aligned} A + B &= C \qquad \text{Addition}\\ A - B &= C \qquad \text{Subtraction}\\ \end{aligned}\]

then the shorthand way to express the airthematic operation is: \[\begin{aligned} a_{ij} + b_{ij} &= c_{ij} \qquad \text{Addition}\\ a_{ij} - b_{ij} &= c_{ij} \qquad \text{Subtraction}\\ \end{aligned}\]

If matrix A and matrix B are both \(m \textsf{x} n\) matrices and their sum/difference is matrix C, then each of the elements of C is the sum/difference of the elements in the corresponding rows and columns of A and B.

Flow Diagram #

flowchart TD M([Start])==>A(Take the corresponding entries from the two matrices)==>B(Add / Subtract them)==>C(Write the result in the resulting matrix at the same position)==>N([End])

Examples #

  1. Given A and B as: \[A = \begin{bmatrix} 5 & 3 \\ 7 & 4 \end{bmatrix}\]
\[B = \begin{bmatrix} 3 & 4 \\ -1 & 1 \end{bmatrix}\]

then

\[A + B = \begin{bmatrix} 5 & 3 \\ 7 & 4 \end{bmatrix} + \begin{bmatrix} 3 & 4 \\ -1 & 1 \end{bmatrix} = \begin{bmatrix} 5 + 3 & 3 + 4 \\ 7 + (-1) & 4 + 1 \end{bmatrix} = \begin{bmatrix} 8 & 7 \\ 6 & 5 \end{bmatrix}\]

and

\[A - B = \begin{bmatrix} 5 & 3 \\ 7 & 4 \end{bmatrix} - \begin{bmatrix} 3 & 4 \\ -1 & 1 \end{bmatrix} = \begin{bmatrix} 5 - 3 & 3 - 4 \\ 7 - (-1) & 4 - 1 \end{bmatrix} = \begin{bmatrix} 2 & -1 \\ 8 & 3 \end{bmatrix}\]
  1. Given M and N as:
\[M = \begin{bmatrix} 0.5 & -2 & 0 \\ -1 & 3.75 & -9 \end{bmatrix}\] \[N = \begin{bmatrix} 1 & 0 & -1 \\ 5 & 3 & -2 \end{bmatrix}\]

then

\[M + N = \begin{bmatrix} 0.5 & -2 & 0 \\ -1 & 3.75 & -9 \end{bmatrix} + \begin{bmatrix} 1 & 0 & -1 \\ 5 & 3 & -2 \end{bmatrix} = \begin{bmatrix} 0.5 + 1 & -2 + 0 & 0 + (-1) \\ -1 + 5 & 3.75 + 3 & -9 + (-2) \end{bmatrix} = \begin{bmatrix} 1.5 & -2 & -1 \\ 4 & 6.75 & -11 \end{bmatrix}\]

and

\[M - N = \begin{bmatrix} 0.5 & -2 & 0 \\ -1 & 3.75 & -9 \end{bmatrix} - \begin{bmatrix} 1 & 0 & -1 \\ 5 & 3 & -2 \end{bmatrix} = \begin{bmatrix} 0.5 - 1 & -2 - 0 & 0 - (-1) \\ -1 - 5 & 3.75 - 3 & -9 - (-2) \end{bmatrix} = \begin{bmatrix} -0.5 & -2 & 1 \\ -6 & 0.75 & -7 \end{bmatrix}\]
  1. Given P and Q as:
\[P = \begin{bmatrix} -3 & 1 \\ 2 & 0 \\ -5 & 4 \end{bmatrix}\] \[Q = \begin{bmatrix} 0 & 0 & -2 \\ 1 & 5 & 8 \end{bmatrix}\]

They cannot be added or subtracted since the orders of the matrices are different.