Matrix Addition — How to Add Two Matrices

Learn how to add two matrices element by element. Matrix addition requires matrices of the same dimensions and produces a result of the same size.

Basic Operations

Detailed Explanation

Matrix Addition Explained

Matrix addition is one of the simplest matrix operations. Given two matrices A and B of the same dimensions (m x n), their sum C = A + B is computed by adding corresponding elements:

C[i,j] = A[i,j] + B[i,j]

Example: Adding Two 2x2 Matrices

A = | 1  2 |    B = | 5  6 |    C = | 6   8 |
    | 3  4 |        | 7  8 |        | 10  12 |

Each element in the result is simply the sum of the elements at the same position in A and B.

Properties of Matrix Addition

  • Commutative: A + B = B + A
  • Associative: (A + B) + C = A + (B + C)
  • Identity element: A + 0 = A (where 0 is the zero matrix)
  • Additive inverse: A + (-A) = 0

Dimension Requirement

Both matrices must have exactly the same dimensions. You cannot add a 2x3 matrix to a 3x2 matrix. This is different from matrix multiplication, which requires the inner dimensions to match but allows different outer dimensions.

Computational Complexity

Matrix addition runs in O(m * n) time where m and n are the matrix dimensions. This is significantly faster than matrix multiplication, which runs in O(n^3) for square matrices using the naive algorithm.

Use Case

Matrix addition is used when combining data from multiple sources represented as matrices. In image processing, adding two image matrices creates an overlay effect. In physics, adding force vectors represented as column matrices gives the resultant force. In neural networks, bias addition to weight matrices is a fundamental operation in forward propagation.

Try It — Matrix Calculator

Open full tool