Beginner

Matrix Subtraction Calculator

Subtract two matrices of the same size by taking the difference of each corresponding entry.
One row per line, numbers separated by spaces
Must match the dimensions of Matrix A
Dimensions of difference matrix
6

2 × 3 entries

Row 1
4 6 -1
Row 2
-1 1 3
Entry (1, 1)4
Entry (1, 2)6
Entry (1, 3)-1
Entry (2, 1)-1
Entry (2, 2)1
Entry (2, 3)3
Step by step
  1. 1

    Rows in each matrix

    2
  2. 2

    Columns in each matrix

    3
  3. 3

    Entries in difference matrix C = A − B

    2 × 3 = 6
Results are estimates for general information only and are not professional advice — always verify important results independently before relying on them. Read the full disclaimer.
Quick answer

How does this calculator work?

To subtract matrices, both must have the same dimensions. Subtract each entry of B from the matching entry of A: C[i][j] = A[i][j] − B[i][j]. The result is a matrix of the same size. Order matters because A − B equals the negation of B − A.

Formula
C[i][j] = A[i][j] − B[i][j]
How this is calculated

Enter Matrix A and Matrix B as text, with one row per line and the numbers in each row separated by spaces or commas. The calculator parses each block into an m×n grid, counting the lines as rows and the values per line as columns.

Matrix subtraction is only defined when both matrices have exactly the same dimensions. The calculator checks that A and B have the same number of rows and the same number of columns; if they differ, or if any row has a ragged length, it reports an error. When the shapes match it computes the difference matrix C with C[i][j] = A[i][j] − B[i][j] for every position, producing another m×n matrix.

The operation is purely positional and unit-agnostic: entry (i, j) of the result depends only on entries (i, j) of the inputs. Note that subtraction is not commutative — A − B is the negation of B − A — so the order you enter the matrices matters. Empty input or non-numeric values are treated as invalid.

Frequently asked questions

No. Matrix subtraction is defined only for matrices with identical dimensions, since each entry is subtracted from the corresponding entry. A 2×3 matrix cannot be subtracted from a 3×2 matrix.

No. Matrix subtraction is not commutative. A − B gives the element-wise differences, while B − A gives the negatives of those values, so the order of entry matters.

Type one row per line, separating the numbers in each row with spaces or commas. Every row must contain the same number of values so the grid is rectangular.

Also known as

subtract matrices
matrix difference
matrix subtraction
minus matrix
difference of matrices
subtracting matrices
matrix subtract

APA

TG we-Calculate Editorial Team. (2026). Matrix Subtraction Calculator [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/matrix-subtraction-calculator

Chicago

TG we-Calculate Editorial Team. "Matrix Subtraction Calculator." TG we-Calculate. 2026. https://we-calculate.com/calculator/matrix-subtraction-calculator.

IEEE

TG we-Calculate Editorial Team, "Matrix Subtraction Calculator," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/matrix-subtraction-calculator

BibTeX

@misc{wecalculate_matrix_subtraction_calculator, title = {Matrix Subtraction Calculator}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/matrix-subtraction-calculator}}, year = {2026}, note = {TG we-Calculate} }

Did this calculator help you?