Definition: Given two matrices $A$ and $B$, both of which are of size $m \times n$, then the sum denoted $A + B$ is an $m \times n$ matrix whose entries are formed by adding corresponding entries of $B$ to corresponding entries of $A$. If $C = A + B$, then $c_{ij} = a_{ij} + b_{ij}$. If the size of matrix $A$ and matrix $B$ are not the same size, then the sum $A + B$ is said to be undefined.

Let's first look at the following $2 \times 3$ matrices $A$ and $B$:

(1)
\begin{align} A = \begin{bmatrix} 3 & 0 & 2\\ 1 & 4 & 2 \end{bmatrix} \quad , \quad B = \begin{bmatrix} 2 & 1 & 3\\ -2 & 5 & 10 \end{bmatrix} \end{align}

To determine the sum of matrix both matrices ($A + B$), we will add corresponding entries of $A$ to $B$. For example, to determine the first entry in our sum, we will take $a_{11} + b_{11}$, that is $3 + 2 = 5$:

(2)
\begin{align} \quad A + B = \begin{bmatrix} 3 & 0 & 2\\ 1 & 4 & 2 \end{bmatrix} + \begin{bmatrix} 2 & 1 & 3\\ -2 & 5 & 10 \end{bmatrix} = \begin{bmatrix} 3 + 2 & 0 + 1 & 2 + 3\\ 1 + (-2) & 4 + 5 & 2 + 10 \end{bmatrix} = \begin{bmatrix} 5 & 1& 5\\ -1 & 9 & 12 \end{bmatrix} \end{align}

Therefore we have that:

(3)
\begin{align} A + B = \begin{bmatrix} 5 & 1& 5\\ -1 & 9 & 12 \end{bmatrix} \end{align}

In general, if we have two $m \times n$ matrices $A = \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n}\\ a_{21} & a_{22} & & a_{2n}\\ \vdots & & \ddots & \vdots\\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{bmatrix}$ and $B = \begin{bmatrix}b_{11} & b_{12} & \cdots & b_{1n}\\ b_{21} & b_{22} & & b_{2n}\\ \vdots & & \ddots & \vdots\\ b_{m1} & b_{m2} & \cdots & b_{mn} \end{bmatrix}$, then the sum $A + B$ is as follows:

(4)
\begin{align} \quad A + B = \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n}\\ a_{21} & a_{22} & & a_{2n}\\ \vdots & & \ddots & \vdots\\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{bmatrix} + \begin{bmatrix}b_{11} & b_{12} & \cdots & b_{1n}\\ b_{21} & b_{22} & & b_{2n}\\ \vdots & & \ddots & \vdots\\ b_{m1} & b_{m2} & \cdots & b_{mn} \end{bmatrix} = \begin{bmatrix} a_{11} + b_{11} & a_{12} + b_{12}& \cdots & a_{1n} + b_{1n}\\ a_{21} + b_{21}& a_{22} + b_{22}& & a_{2n} + b_{2n}\\ \vdots & & \ddots & \vdots\\ a_{m1} + b_{m1} & a_{m2} + b_{m2}& \cdots & a_{mn} + b_{mn} \end{bmatrix} \end{align}

## Example 1

Given the following matrices, determine the resulting matrix $A + B$:

(5)
\begin{align} A = \begin{bmatrix} 2 & 1\\ 4 & 3 \end{bmatrix} \quad , \quad B = \begin{bmatrix} 9 & -2\\ -5 & -3 \end{bmatrix} \end{align}

We must first sum up corresponding entries:

(6)
\begin{align} a_{11} + b_{11} = 2 + 9 = 11 \\ a_{12} + b_{12} = 1 + (-2) = -1 \\ a_{21} + b_{21} = 4 + (-5) = -1 \\ a_{22} + b_{22} = 3 + (-3) = 0 \end{align}

These are the entries of our matrix and therefore:

(7)
\begin{align} A + B = \begin{bmatrix} 11 & -1\\ -1 & 0 \end{bmatrix} \end{align}

# Matrix Subtraction

 Definition: Given two matrices $A$ and $B$, both of which are of size $m \times n$, the difference $A - B$ is an $m \times n$ matrix whose entries are formed by subtracting entries of $B$ from corresponding entries of $A$. If $C = A - B$, then $c_{ij} = a_{ij} - b_{ij}$. If the size of matrix $A$ and matrix $B$ are not the same, then the difference $A - B$ is said to be undefined.

Subtracting two same-size matrices is very similar to adding matrices with the only difference being subtracting corresponding entries.

## Example 2

Using the matrices from example 1, determine the resulting matrix $A - B$.

This time we will find the difference between the entries of $B$ from $A$ (taking an entry of $A$ and subtracting the corresponding entry in $B$):

(8)
\begin{align} a_{11} - b_{11} = 2 - 9 = -7 \\ a_{12} - b_{12} = 1 - (-2) = 3 \\ a_{21} - b_{21} = 4 - (-5) = 9 \\ a_{22} - b_{22} = 3 - (-3) = 6 \end{align}

These are the entries of our matrix and therefore:

(9)
\begin{align} A - B = \begin{bmatrix} -7 & 3\\ 9 & 6 \end{bmatrix} \end{align}