Matrix Addition and Scalar Multiplication

April 13, 2026

Problem

For A = [[1,2],[3,4]] and B = [[5,6],[7,8]], compute A + B, A − B, and 3A. Explain why these operations are element-wise.

Explanation

The two simplest matrix operations

Matrix addition (only for matrices of the same size): (A+B)ij=Aij+Bij(A + B)_{ij} = A_{ij} + B_{ij}

Scalar multiplication: (cA)ij=cAij(cA)_{ij} = c \cdot A_{ij}

Both are element-wise — each entry is computed independently.

Step-by-step

Setup: A=(1234), B=(5678)A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}, \ B = \begin{pmatrix} 5 & 6 \\ 7 & 8 \end{pmatrix}.

A + B: A+B=(1+52+63+74+8)=(681012)A + B = \begin{pmatrix} 1+5 & 2+6 \\ 3+7 & 4+8 \end{pmatrix} = \begin{pmatrix} 6 & 8 \\ 10 & 12 \end{pmatrix}

A − B: AB=(15263748)=(4444)A - B = \begin{pmatrix} 1-5 & 2-6 \\ 3-7 & 4-8 \end{pmatrix} = \begin{pmatrix} -4 & -4 \\ -4 & -4 \end{pmatrix}

3A: 3A=(31323334)=(36912)3A = \begin{pmatrix} 3 \cdot 1 & 3 \cdot 2 \\ 3 \cdot 3 & 3 \cdot 4 \end{pmatrix} = \begin{pmatrix} 3 & 6 \\ 9 & 12 \end{pmatrix}

Properties

These operations make Rm×n\mathbb{R}^{m \times n} (the set of m×nm \times n real matrices) into a vector space:

  • Commutative: A+B=B+AA + B = B + A.
  • Associative: (A+B)+C=A+(B+C)(A + B) + C = A + (B + C).
  • Zero matrix: A+0=AA + 0 = A where 00 has every entry zero.
  • Additive inverse: A+(A)=0A + (-A) = 0.
  • Distributive over scalars: c(A+B)=cA+cBc(A + B) = cA + cB, (c+d)A=cA+dA(c + d)A = cA + dA.
  • Scalar associativity: c(dA)=(cd)Ac(dA) = (cd) A.

Dimension must match

A+BA + B is undefined if AA and BB have different shapes. A 2×32 \times 3 matrix and a 3×23 \times 2 matrix cannot be added — not even by transposing first. The sum only makes sense element-by-element, and that requires matched shapes.

Geometric interpretation

Think of a matrix as a list of column vectors (or row vectors). Addition adds the vectors componentwise; scalar multiplication stretches each by the same factor. On the 2×22 \times 2 example:

  • Columns of AA: a1=(1,3)\mathbf{a}_1 = (1, 3), a2=(2,4)\mathbf{a}_2 = (2, 4).
  • Columns of 3A3A: 3a1=(3,9)3\mathbf{a}_1 = (3, 9), 3a2=(6,12)3\mathbf{a}_2 = (6, 12) — same directions, three times longer.

Common mistakes

  • Mixing unequal shapes. Double-check dimensions before adding.
  • Applying the scalar to only the first entry. A scalar multiplies every entry.
  • Confusing addition with multiplication. Matrix multiplication is a completely different operation involving dot products, and it's not element-wise.

Try it in the visualization

Adjust the scalar cc with a slider and watch each entry of cAcA update. Toggle AA vs. BB vs. A+BA + B to see the overlay.

Interactive Visualization

Parameters

1.00
2.00
3.00
4.00
3.00
A + B
Your turn

Got your own math or physics problem?

Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.

Sign Up Free to Try It30 free visualizations every day
Matrix Addition and Scalar Multiplication | MathSpin