Skip to main content
Skip to calculator
Advertisement

Last updated: August 1, 2026

Matrix Addition and Subtraction Calculator

Quick Answer

Enter Matrix A and Matrix B in the same row-based format and choose add or subtract. The calculator checks that both matrices have identical dimensions, combines the entries position by position, and returns the resulting matrix together with the accepted dimensions and the operation used.

Enter two matrices of the same size and choose add or subtract to combine them entry by entry.

Helpful
Not helpful
Save as image
Share
Embed
Cite
Write feedback

Formula

For equal-sized matrices, (A ± B)ij = aij ± bij.

Where:

  • A=first matrix
  • B=second matrix
  • A ± B=entry-wise sum or difference
Matrix Addition and SubtractionMatrix addition and subtraction combine entries position by position, so matching dimensions are essential.Matrix Addition and SubtractionMatrix view[ a₁₁ a₁₂ ⋯ ][ a₂₁ a₂₂ ⋯ ][ ⋮ ⋮ ⋱ ]Core formula(A ± B)ᵢⱼ = aᵢⱼ ± bᵢⱼMatrices must have the same dimensionsAddition and subtraction are entry-wiseThe result keeps the original shape
Matrix addition and subtraction combine entries position by position, so matching dimensions are essential.

Worked Examples

Add two 2×2 matrices

Compute [[1,2],[3,4]] + [[5,6],[7,8]].

  1. 1Match entries by position.
  2. 2Add each pair.
  3. 3Keep the same shape.
Final Answer: resultMatrix = [[6, 8], [10, 12]]

Subtract two 2×2 matrices

Compute A - B for the same pair.

  1. 1Match entries by position.
  2. 2Subtract B from A entry by entry.
Final Answer: resultMatrix = [[-4, -4], [-4, -4]]

Decimal entries

Work with finite decimals.

  1. 1Enter the rows.
  2. 2Combine corresponding positions.
  3. 3Review the rounded output.
Final Answer: resultMatrix = [[2, 4], [5, 5]]

Dimension mismatch

A 2×2 and 2×3 matrix cannot be added.

  1. 1Compare shapes first.
  2. 2Stop when the dimensions differ.
Final Answer: The calculator returns a validation error.

Introduction

Add or subtract two matrices entry by entry when their shapes match.

Overview

Add or subtract two matrices entry by entry when their shapes match.

  • Result matrix

  • Basic matrix algebra homework

  • Comparing coefficient tables

  • Transformation updates

Input format

Use the same row-based format for both matrices.

  • Separate rows with semicolons

  • Separate entries with commas or spaces

  • Brackets are optional

  • Keep row lengths consistent

Formula and method

For equal-sized matrices, (A ± B)ij = aij ± bij.

A matters:

first matrix.

B matters:

second matrix.

A ± B matters:

entry-wise sum or difference.

Validation rules

The calculator uses deterministic validation before it computes the final result.

  • Both matrices must be rectangular

  • Both matrices must have the same dimensions

  • The operation must be add or subtract

  • Every entry must be finite

Interpreting the outputs

Use the main result first, then the secondary fields to verify the structure and meaning of the answer.

  • The result matrix keeps the common shape

  • dimensions confirms the accepted size

  • operationUsed echoes the chosen mode

  • Subtraction is always A - B in that order

Common use cases

These are typical reasons to use this calculator in study or applied work.

  • Basic matrix algebra homework

  • Comparing coefficient tables

  • Transformation updates

  • Quick element-wise checks

FAQs

Why must the matrices have the same size?

Because each entry in A needs a matching entry in B.

Can I use decimals or negatives?

Yes. Any finite real entries are supported.

Does subtract mean B - A?

No. The subtract option computes A - B.

How do I enter a 3×3 matrix?

Use a format like 1,2,3;4,5,6;7,8,9.

Is this the same as matrix multiplication?

No. Addition and subtraction are entry-wise operations.

What if my rows have different lengths?

The calculator rejects the input because the matrix is not rectangular.