Adding Matrices Entry by Entry
Matrix addition uses a direct rule: match entries that occupy the same row and column, then add those entries. This makes the sizes of the matrices essential. A first-row, second-column entry can be paired with another first-row, second-column entry, but not with an entry in a different position. Throughout, matrices have real entries.
Let \(\mathbf{A}=[a_{ij}]\) and \(\mathbf{B}=[b_{ij}]\) be \(m\times n\) matrices. The indices \(i\) and \(j\) specify the row and column, respectively, so \(a_{ij}\) and \(b_{ij}\) occupy corresponding positions. The matrices must have the same number of rows and the same number of columns. Having the same number of entries in total is not sufficient: the arrangement into rows and columns must match.
The resulting matrix has the same dimensions as each input: the rule makes one entry for every position in an \(m\times n\) matrix. Addition does not combine entries across rows or columns; each output entry is computed from exactly two entries in the same position.
Worked Example: Adding Two 2 × 2 Matrices
Find the sum of \(\mathbf{A}=\begin{bmatrix}2&-1\\4&3\end{bmatrix}\) and \(\mathbf{B}=\begin{bmatrix}5&6\\-2&1\end{bmatrix}\).
Both matrices are \(2\times2\), so their entries can be matched position by position. Compute each entry of the sum:
Check: The \((1,1)\) entry is \(7=2+5\), the \((1,2)\) entry is \(5=-1+6\), the \((2,1)\) entry is \(2=4+(-2)\), and the \((2,2)\) entry is \(4=3+1\). Each entry agrees with the definition, and the result is \(2\times2\).
Rectangular Matrices and Position Matching
Square matrices are not required. An \(m\times n\) matrix may be added to any other \(m\times n\) matrix, including when \(m\ne n\). The same position rule applies: row \(i\), column \(j\) is added to row \(i\), column \(j\). Writing out the entry calculations is especially helpful with rectangular matrices, because it makes the matching positions visible.
Worked Example: Adding Rectangular Matrices
Compute \(\mathbf{C}+\mathbf{D}\), where
Both matrices have two rows and three columns. Add corresponding entries, keeping the first row paired with the first row and the second row paired with the second row:
Check: Reading the result position by position gives \(-1=1+(-2)\), \(7=0+7\), \(-2=-3+1\), \(8=2+6\), \(4=5+(-1)\), and \(4=4+0\). The answer is \(2\times3\), matching both inputs.
The rule also tells us precisely why matching dimensions are required. Every entry of one matrix has to be paired with the entry of the other matrix in the same row and column. If the row counts or column counts differ, at least one matrix has a position for which its proposed partner does not exist—or the two layouts do not describe the same set of positions. The entrywise addition rule therefore does not define a sum in that situation.
Proof. First suppose \(\mathbf{A}\) and \(\mathbf{B}\) both have dimensions \(m\times n\). For each pair of indices \(i,j\) with \(1\le i\le m\) and \(1\le j\le n\), the real numbers \(a_{ij}\) and \(b_{ij}\) have a sum \(a_{ij}+b_{ij}\). Place this sum in position \((i,j)\) of \(\mathbf{C}\). Doing so for every such pair constructs an \(m\times n\) matrix satisfying the stated entry formula, so such a matrix exists. If \(\mathbf{C}\) and \(\mathbf{D}\) both satisfy the formula, then \(c_{ij}=a_{ij}+b_{ij}=d_{ij}\) for every position. Matrices with the same dimensions and equal entries in every position are equal, so \(\mathbf{C}=\mathbf{D}\). Thus the matrix is unique. Conversely, the definition of matrix addition pairs entries at the same row and column positions and produces one entry at every position in the result. That rule applies to two matrices precisely when their row and column positions match, which requires the same number of rows and the same number of columns. \(\square\)
Subtracting Matrices Entry by Entry
Matrix subtraction follows the same position-matching requirement as addition, but subtracts the second entry from the first. The order matters: the entry from the matrix written first is the minuend, and the entry from the matrix written second is the subtrahend. In particular, \(\mathbf{A}-\mathbf{B}\) and \(\mathbf{B}-\mathbf{A}\) are computed using the same positions but with the order of the real-number subtraction reversed.
Every subtraction is ordinary real-number subtraction at one position. A negative entry in either input creates no special rule: it is still included with its sign when the corresponding entries are subtracted.
Worked Example: A Difference with Negative Entries
Find \(\mathbf{A}-\mathbf{B}\) for
Both matrices are \(2\times3\). Subtract the entry of \(\mathbf{B}\) from the entry of \(\mathbf{A}\) in each position:
Check: The entries are \(3=4-1\), \(-5=-3-2\), \(6=2-(-4)\), \(6=0-(-6)\), \(2=5-3\), and \(-3=-1-2\). This confirms the result position by position, including the two subtractions in which a negative number is subtracted.
Proof. Let the common dimensions be \(m\times n\). By the definition of difference, the entry in position \((i,j)\) of \(\mathbf{A}-\mathbf{B}\) is \(a_{ij}-b_{ij}\). If \(\mathbf{A}-\mathbf{B}=\mathbf{O}\), every entry of the difference is zero, so \(a_{ij}-b_{ij}=0\) for every \(i,j\). Hence \(a_{ij}=b_{ij}\) at every position, and the matrices are equal. For the reverse direction, suppose \(\mathbf{A}=\mathbf{B}\). Equality of matrices means \(a_{ij}=b_{ij}\) for every position. Therefore \(a_{ij}-b_{ij}=0\) for every position, so every entry of \(\mathbf{A}-\mathbf{B}\) is zero. Thus \(\mathbf{A}-\mathbf{B}=\mathbf{O}\). \(\square\)
Worked Example: Checking a Difference Against the Inputs
Let \(\mathbf{P}=\begin{bmatrix}3&1\\-2&4\end{bmatrix}\) and \(\mathbf{Q}=\begin{bmatrix}5&-3\\1&-1\end{bmatrix}\). Compute \(\mathbf{P}-\mathbf{Q}\), then check that every entry follows the subtraction rule.
Subtract corresponding entries in the order \(\mathbf{P}\) minus \(\mathbf{Q}\):
Check: In position \((1,1)\), \(-2=3-5\); in position \((1,2)\), \(4=1-(-3)\); in position \((2,1)\), \(-3=-2-1\); and in position \((2,2)\), \(5=4-(-1)\). Every output entry is the first input entry minus the second input entry in that position.
Common Mistakes and Reliable Checks
Adding matrices with different dimensions. A tempting but incorrect calculation is to add \(\begin{bmatrix}1&2\\3&4\end{bmatrix}\) to \(\begin{bmatrix}5&6&7\\8&9&10\end{bmatrix}\) by using only the first two columns and ignoring the third. The first matrix is \(2\times2\), while the second is \(2\times3\). Their positions do not match, so their sum is not defined; ignoring entries does not repair the mismatch. Check both row counts and column counts before adding or subtracting.
Reversing the subtraction order. For the matrices in the last example, the \((1,2)\) entry of \(\mathbf{P}-\mathbf{Q}\) is \(1-(-3)=4\). The incorrect calculation \(-3-1=-4\) uses the entry of \(\mathbf{Q}\) first, so it computes the corresponding entry in the opposite order. To correct it, follow the expression from left to right at every position: use the entry from the first matrix, then subtract the entry from the second.
A useful check is to annotate the dimensions and inspect all positions. For matrices of size \(m\times n\), there are \(mn\) entries to compute. Each output must have the same dimensions, and each of its entries must be traceable to the two input entries in that exact position. For subtraction, also check the order explicitly, especially when negative entries occur.
Check Your Understanding
For each question, state the dimensions involved and use the entrywise rule to justify your answer.
- Compute \(\begin{bmatrix}2&-4\\1&0\end{bmatrix}+\begin{bmatrix}3&5\\-1&7\end{bmatrix}\).
- Can a \(3\times2\) matrix be added to a \(2\times3\) matrix? Explain why or why not.
- Compute \(\begin{bmatrix}0&6&-2\end{bmatrix}-\begin{bmatrix}-3&1&4\end{bmatrix}\).
- For same-sized matrices \(\mathbf{A}\) and \(\mathbf{B}\), explain why \(\mathbf{A}-\mathbf{B}=\mathbf{O}\) implies \(\mathbf{A}=\mathbf{B}\).
- Find and correct the sign error in the claim that the \((1,2)\) entry of \(\begin{bmatrix}4&-2\end{bmatrix}-\begin{bmatrix}1&3\end{bmatrix}\) is \(3-(-2)\).