For matrix addition to be defined, both matrices must be of the same dimension, that is, both matrices must have the same number of rows and columns. Addition then proceeds by adding corresponding components, as in

$$C_{ij}=A_{ij}+B{ij}\text{.}\tag{3.1.1}$$

For example, if

$$A = \left(\begin{array}{cc} a\amp b\\ c\amp d \end{array} \right) ,\qquad B = \left(\begin{array}{cc} e\amp f\\ g\amp h \end{array} \right)\text{,}\tag{3.1.2}$$

then

$$A+B= \left(\begin{array}{cc} a\amp b\\ c\amp d \end{array} \right) + \left(\begin{array}{cc} e\amp f\\ g\amp h \end{array} \right) = \left(\begin{array}{cc} a+e\amp b+f\\ c+g\amp d+h \end{array} \right)\text{.}\tag{3.1.3}$$

Similarly,

$$\left(\begin{array}{cc} 1\amp 2\\ 3\amp 4\\ 5\amp 6 \end{array} \right) + \left(\begin{array}{cc} 7\amp 8\\ 9\amp 10\\ 11\amp 12 \end{array} \right) = \left(\begin{array}{cc} 8\amp 10\\ 12\amp 14\\ 16\amp 18 \end{array} \right)\text{.}\tag{3.1.4}$$

However,

$$\left(\begin{array}{cc} 1\amp 2\\ 3\amp 4 \end{array} \right) + \left(\begin{array}{ccc} 5\amp 6\amp 7\\ 8\amp 9\amp 10\\ 11\amp 12\amp 13 \end{array} \right)\tag{3.1.5}$$

is undefined.