Matrix Subtraction Calculator
Subtract two matrices of the same size by taking the difference of each corresponding entry.
2 × 3 entries
- 1
Rows in each matrix
2 - 2
Columns in each matrix
3 - 3
Entries in difference matrix C = A − B
2 × 3 = 6
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
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
TG we-Calculate Editorial Team. (2026). Matrix Subtraction Calculator [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/matrix-subtraction-calculator
TG we-Calculate Editorial Team. "Matrix Subtraction Calculator." TG we-Calculate. 2026. https://we-calculate.com/calculator/matrix-subtraction-calculator.
TG we-Calculate Editorial Team, "Matrix Subtraction Calculator," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/matrix-subtraction-calculator
@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?
