Matrix addition
1. Addition of 2 matrices
Matrix addition is the operation of adding two matrices by adding the corresponding entries together. Given two matrices \(A\), \(B\) that must have an equal number of rows and columns \((m\times n)\).
\[
\begin{align}
\begin{bmatrix}A\end{bmatrix} + \begin{bmatrix}B\end{bmatrix} &=
\begin{bmatrix}
a_{11} & a_{12} & \dots & a_{1n} \\
a_{21} & a_{22} & \dots & a_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
a_{m1} & a_{m2} & \dots & a_{mn}
\end{bmatrix}
+
\begin{bmatrix}
b_{11} & b_{12} & \dots & b_{1n} \\
b_{21} & b_{22} & \dots & b_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
b_{m1} & b_{m2} & \dots & b_{mn}
\end{bmatrix} \\
&=
\begin{bmatrix}
a_{11} + b_{11} & a_{12} + b_{12} & \dots & a_{1n} + b_{1n} \\
a_{21} + b_{21} & a_{22} + b_{22} & \dots & a_{2n} + b_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
a_{m1} + b_{m1} & a_{m2} + b_{m2} & \dots & a_{mn} + b_{mn} \\
\end{bmatrix}
\end{align}
\]
\[
A + B = C
\Rightarrow
c_{ij} = a_{ij} + b_{ij}
\]
For example
\[
\begin{bmatrix}
1 & 2 \\
3 & 4 \\
5 & 6
\end{bmatrix}
+
\begin{bmatrix}
0 & 6 \\
1 & 2 \\
3 & 0
\end{bmatrix}
=
\begin{bmatrix}
1 & 8 \\
4 & 6 \\
8 & 6
\end{bmatrix}
\]
2. Subtraction of 2 matrices
Similarly, we can also subtract one matrix from another, as long as they have the same dimensions.
\[
\begin{align}
\begin{bmatrix}A\end{bmatrix} – \begin{bmatrix}B\end{bmatrix} &=
\begin{bmatrix}
a_{11} & a_{12} & \dots & a_{1n} \\
a_{21} & a_{22} & \dots & a_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
a_{m1} & a_{m2} & \dots & a_{mn}
\end{bmatrix}
–
\begin{bmatrix}
b_{11} & b_{12} & \dots & b_{1n} \\
b_{21} & b_{22} & \dots & b_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
b_{m1} & b_{m2} & \dots & b_{mn}
\end{bmatrix} \\
&=
\begin{bmatrix}
a_{11} – b_{11} & a_{12} – b_{12} & \dots & a_{1n} – b_{1n} \\
a_{21} – b_{21} & a_{22} – b_{22} & \dots & a_{2n} – b_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
a_{m1} – b_{m1} & a_{m2} – b_{m2} & \dots & a_{mn} – b_{mn} \\
\end{bmatrix}
\end{align}
\]
\[
A – B = C
\Rightarrow
c_{ij} = a_{ij} – b_{ij}
\]
For example
\[
\begin{bmatrix}
1 & 2 \\
3 & 4 \\
5 & 6
\end{bmatrix}
–
\begin{bmatrix}
0 & 6 \\
1 & 2 \\
3 & 0
\end{bmatrix}
=
\begin{bmatrix}
1 & -4 \\
2 & 2 \\
2 & 6
\end{bmatrix}
\]