Skip to content
Glacius
Linear algebraConcept reference

Matrix addition

The sum of equal-shape matrices adds each pair of corresponding entries.

On this page 7 sections
  1. Overview
  2. Matrix addition combines entries at the same position
  3. Equal entry counts are insufficient for addition
  4. For data tables, keep the row and column meanings aligned
  5. Key takeaway
  6. Sources & further reading
  7. Concept connections

01Matrix addition combines entries at the same position#

Matrix addition combines entries at the same position. Both inputs must have the same number of rows and the same number of columns.

For the displayed inputs, the upper-right entry is 1+2=1-1+2=1. Add the other three matching pairs in their own positions.

A has rows (2, −1), (0, 3); B has rows (4, 2), (1, −3). Their sum has rows (6, 1), (1, 0). The upper-right positions show −1+2=1. Every output keeps the same position as its two inputs.A has rows (2, −1), (0, 3); B has rows (4, 2), (1, −3). Their sum has rows (6, 1), (1, 0). The upper-right positions show −1+2=1. Every output keeps the same position as its two inputs.
Figure 1A has rows (2, −1), (0, 3); B has rows (4, 2), (1, −3). Their sum has rows (6, 1), (1, 0). The upper-right positions show −1+2=1. Every output keeps the same position as its two inputs.
Link to this figure ↗Download SVGDownload PNG
Check your reasoning

Add [21]+[34]\begin{bmatrix}2&-1\end{bmatrix}+\begin{bmatrix}3&4\end{bmatrix}.

  1. A[53]\begin{bmatrix}5&3\end{bmatrix}
  2. B[64]\begin{bmatrix}6&-4\end{bmatrix}
  3. C[35]\begin{bmatrix}3&5\end{bmatrix}
Show answer and explanation
[53]\begin{bmatrix}5&3\end{bmatrix}

Match positions: (5,3)(5,3).

02Equal entry counts are insufficient for addition#

Equal entry counts are insufficient for addition. Shapes 2×32\times3 and 3×23\times2 have 6 entries each, but their positions do not line up, so addition is undefined.

Check your reasoning

CC is this sum. Find c21c_{21}. [1234]+[2051]\begin{bmatrix}1&2\\-3&4\end{bmatrix}+\begin{bmatrix}2&0\\5&1\end{bmatrix}

Show answer and explanation
2

Row 2, column 1: 3+5=2-3+5=2.

03For data tables, keep the row and column meanings aligned#

For data tables, keep the row and column meanings aligned. If a column counts dogs in both inputs, adding those positions gives the combined dog count.

Check your reasoning

Columns: (cats, dogs). Add these daily counts: [13]+[24]\begin{bmatrix}1&3\end{bmatrix}+\begin{bmatrix}2&4\end{bmatrix}

  1. A[37]\begin{bmatrix}3&7\end{bmatrix}
  2. B[212]\begin{bmatrix}2&12\end{bmatrix}
  3. C[55]\begin{bmatrix}5&5\end{bmatrix}
Show answer and explanation
[37]\begin{bmatrix}3&7\end{bmatrix}

Cats plus cats; dogs plus dogs: (3,7)(3,7).

Key takeaway

Same shape first; add at each matching position.

  • Add matrices of equal shape.

Sources & further reading

  1. [1]

Reference this concept

Link to this page, a section, or an individual figure.

Glacius. “Matrix addition.” Math behind ML. /learn/la-matrix-add