Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Matrix Addition&Subtraction


Symbolic visualization of A ± B = C, cell by cell.

Operation
Dimensions (shared by A and B)?A and B must have the same dimensions — the same number of rows and the same number of columns. The result C has that same shape, and each cell of C is computed from the corresponding pair of cells in A and B.
A, B2×3
A2×3
a1,1
a1,2
a1,3
a2,1
a2,2
a2,3
+
B2×3
b1,1
b1,2
b1,3
b2,1
b2,2
b2,3
=
C2×3
?
?
?
?
?
?
Step 1 / 8

Step explanations

1Matrix addition
Both A and B are 2×3. To compute C = A + B, pair up each cell of A with its counterpart in B and add them.












Key Terms

Matrix addition — combining two matrices of the same shape into a third matrix by adding paired entries: ci,j=ai,j+bi,jc_{i,j} = a_{i,j} + b_{i,j}.

Matrix subtraction — combining two matrices of the same shape by subtracting paired entries: ci,j=ai,jbi,jc_{i,j} = a_{i,j} - b_{i,j}.

Element-wise operation — an operation applied independently to each entry; the result at position (i,j)(i,j) depends only on the inputs at position (i,j)(i,j).

Same-shape requirement — both operand matrices must have identical row and column counts. A 2×32 \times 3 matrix cannot be added to a 3×23 \times 2 matrix.

Result shape — the output matrix CC inherits the shape of the operands. If AA and BB are m×nm \times n, then CC is m×nm \times n.

Conformability — the condition under which an operation is defined. For addition and subtraction, conformability means matching dimensions.
Learn More

Getting Started with the Visualizer

Choose an operation and a shape, then watch the result build up one cell at a time.

• Use the Operation segmented control to switch between A + B and A − B
• Set the shared shape of AA and BB with the Dimensions steppers — rows and columns each range from 1 to 5
• Click play on the scene player to step through each cell of CC, or use the speed selector to slow down or speed up the animation

The hover ? icon next to the dimensions label explains why AA and BB must share the same shape. Because the operation is element-wise, no other configuration is needed — the visualizer fully determines the symbolic flow from the operation and shape alone.
Learn More

Reading the Scene Player

Each scene focuses on a single cell of CC and shows three pieces of information at once.

Highlighted cells — the active cell in AA is colored as primary, the matching cell in BB as secondary, and the destination cell in CC as accent
Curved arrows — two arrows flow from ai,ja_{i,j} and bi,jb_{i,j} into ci,jc_{i,j}, making the data flow explicit
Formula caption — the title shows the cell-level equation, for example c2,3=a2,3+b2,3c_{2,3} = a_{2,3} + b_{2,3}
Step log — a running record of completed steps appears below the matrices, so you can scroll back through what has been filled in

By the final scene, every cell of CC holds its symbolic sum or difference and the matrices visualize the complete operation.
Learn More

Switching Between Addition and Subtraction

The operation toggle changes both the symbol in the equation and the contents of each cell of CC.

• Selecting A + B displays ci,j=ai,j+bi,jc_{i,j} = a_{i,j} + b_{i,j} in every filled cell
• Selecting A − B displays ci,j=ai,jbi,jc_{i,j} = a_{i,j} - b_{i,j} in every filled cell
• The intro and outro scene captions update to use the words "addition" or "subtraction" accordingly
• The per-cell scene titles also update their operator

Toggling the operation rebuilds the full sequence of scenes, so you can compare how addition and subtraction differ purely in operator while sharing the exact same element-wise structure.
Learn More

Choosing Dimensions

The dimension steppers control the shape shared by all three matrices. Because AA, BB, and CC are linked, changing rows or columns updates all of them at once.

• Start with a small shape like 2×22 \times 2 or 2×32 \times 3 to see the per-cell flow clearly
• Increase to 4×44 \times 4 or 5×55 \times 5 to see how the same rule scales — the number of scenes grows as m×nm \times n
• Symbolic cell contents in CC shrink automatically when the matrix is larger, so ai,j+bi,ja_{i,j} + b_{i,j} stays readable even at 5×55 \times 5
• A square shape (n×nn \times n) and a rectangular shape (m×nm \times n, mnm \neq n) follow the same rule, since dimensions never need to match across rows and columns for addition

There is no separate control for CC because its shape is forced by the operation.
Learn More

What Matrix Addition Is

Matrix addition pairs up corresponding entries of two matrices and sums them. If AA and BB are both m×nm \times n matrices, then A+BA + B is also m×nm \times n, and its entry at row ii, column jj is

ci,j=ai,j+bi,jc_{i,j} = a_{i,j} + b_{i,j}


This makes matrix addition an element-wise operation: each entry of the result depends only on the matching entries in AA and BB, not on anything else in either matrix.

Matrix subtraction works identically, with subtraction replacing addition. The same-shape requirement is what makes the operation well-defined — without matched dimensions, there is no notion of "corresponding entry."

For a comprehensive treatment of matrix operations and properties, see matrix operations theory.
Learn More

Key Formulas

The full definition of matrix addition for m×nm \times n matrices AA and BB:

A+B=C,ci,j=ai,j+bi,j for all 1im,1jnA + B = C, \quad c_{i,j} = a_{i,j} + b_{i,j} \text{ for all } 1 \leq i \leq m, \, 1 \leq j \leq n


Matrix subtraction:

AB=C,ci,j=ai,jbi,jA - B = C, \quad c_{i,j} = a_{i,j} - b_{i,j}


Matrix addition satisfies the same algebraic properties as ordinary addition:

Commutativity: A+B=B+AA + B = B + A
Associativity: (A+B)+C=A+(B+C)(A + B) + C = A + (B + C)
Identity: A+0=AA + 0 = A, where 00 is the zero matrix of the same shape
Inverse: A+(A)=0A + (-A) = 0

Subtraction is neither commutative nor associative, just like with scalars.
Learn More

Why the Same-Shape Rule Matters

Matrix addition is only defined when both operands have identical dimensions. This rule is not arbitrary — it follows directly from the element-wise definition.

If AA is 2×32 \times 3 and BB is 2×42 \times 4, then a1,4a_{1,4} does not exist while b1,4b_{1,4} does. There is no entry in AA to pair with b1,4b_{1,4}, so the sum at that position is undefined. The same problem arises for any mismatch in rows or columns.

This is fundamentally different from matrix multiplication, where the inner dimensions must match but the outer dimensions can differ. Addition demands strict equality of shape; multiplication allows asymmetry.

For comparison with matrix multiplication and other operations, see matrix multiplication.
Learn More

Common Mistakes

Even though matrix addition is among the simplest matrix operations, a few mistakes appear regularly.

Trying to add matrices of different shapes — a 2×32 \times 3 and a 3×23 \times 2 cannot be added even though both have six entries
Adding a scalar to a matrix as if it were a matrix — adding a scalar kk to AA means adding kk to every entry, which is technically scalar shifting, not matrix addition
Confusing element-wise multiplication with matrix multiplication — element-wise (Hadamard) product also requires matching shapes, but standard matrix multiplication does not
Forgetting that subtraction is not commutativeABBAA - B \neq B - A in general
Mixing row vectors and column vectors — a 1×n1 \times n row vector cannot be added to an n×1n \times 1 column vector even when they have the same number of entries
Learn More

Worked Example

Take AA and BB as 2×32 \times 3 matrices:

A=(123456),B=(789012)A = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix}, \quad B = \begin{pmatrix} 7 & 8 & 9 \\ 0 & 1 & 2 \end{pmatrix}


Then C=A+BC = A + B is computed cell by cell:

C=(1+72+83+94+05+16+2)=(81012468)C = \begin{pmatrix} 1+7 & 2+8 & 3+9 \\ 4+0 & 5+1 & 6+2 \end{pmatrix} = \begin{pmatrix} 8 & 10 & 12 \\ 4 & 6 & 8 \end{pmatrix}


For D=ABD = A - B:

D=(172839405162)=(666464)D = \begin{pmatrix} 1-7 & 2-8 & 3-9 \\ 4-0 & 5-1 & 6-2 \end{pmatrix} = \begin{pmatrix} -6 & -6 & -6 \\ 4 & 6 & 4 \end{pmatrix}


The visualizer above mirrors this process symbolically — set the dimensions to 2×32 \times 3 and step through to see each pairing in turn.
Learn More

Related Concepts

Matrix operations — the broader family that includes addition, subtraction, multiplication, transposition, and inversion.

Scalar multiplication — multiplying every entry of a matrix by a number; like addition, it is element-wise and preserves shape.

Matrix multiplication — a non-element-wise operation with different conformability rules and very different geometric meaning.

Hadamard product — element-wise multiplication of two matrices of the same shape, the multiplicative analogue of matrix addition.

Vector addition — the special case where both matrices are row or column vectors; the same element-wise rule applies.

Zero matrix — the additive identity, with every entry equal to zero.

Transpose — reflecting a matrix across its main diagonal; useful when combining matrices of incompatible shapes through related operations.
Learn More