FREE ONLINE LINEAR ALGEBRA TOOL

Matrix Subtraction Calculator

Calculate A − B with this free matrix subtraction calculator. Enter the entries of two matrices, choose their dimensions, and get the difference with a breakdown of every subtraction. Negative and decimal results are supported.

Calculate A − B ↓
MATRIX CALCULATOR

Subtract two matrices

Matrix A minus Matrix B. Both matrices must have identical dimensions. Supports matrices from 1 × 1 to 8 × 8.

Operation
A − B = C
Matrix A
−
Subtract corresponding entries
Matrix B
THE MATHEMATICS

How matrix subtraction works

Matrix subtraction is performed entry by entry. If A and B have the same dimensions, subtract each entry of B from the entry in the same position in A. The resulting matrix retains the original dimensions.

A − B = C Cᵢⱼ = Aᵢⱼ − Bᵢⱼ

1. Check the dimensions

Both matrices must have the same number of rows and columns. For example, two 2 × 3 matrices can be subtracted.

2. Subtract matching entries

Subtract the value in row i and column j of B from the value in row i and column j of A.

3. Form the difference

Place every difference in the matching position of C. Negative, positive and zero values are all valid results.

Worked example

A = [ 5 1 ] B = [ 3 4 ] [ 0 -2 ] [ 7 -6 ] A − B = [ 5−3 1−4 ] = [ 2 -3 ] [ 0−7 -2−(-6)] [ -7 4 ]

The result is a 2 × 2 matrix: [[2, -3], [-7, 4]].

Properties of matrix subtraction

Order matters

Matrix subtraction is not generally commutative: A − B is usually not equal to B − A.

Same dimensions

The two matrices must have matching row and column counts. The result keeps those dimensions.

Subtracting a matrix from itself

For every matrix A, A − A equals the zero matrix of the same dimensions.

Connection to addition

Subtracting B is equivalent to adding its negative: A − B = A + (−B).

Frequently asked questions

How do you subtract two matrices?

Subtract each entry of the second matrix from the entry in the same row and column of the first matrix. Both matrices must have the same dimensions.

Can matrices with different dimensions be subtracted?

No. Standard matrix subtraction is defined only when the matrices have the same number of rows and columns.

Is A − B the same as B − A?

Generally, no. Reversing the order changes the sign of the difference: B − A = −(A − B).

Can the answer contain negative numbers?

Yes. A result entry is negative whenever the corresponding entry in Matrix A is smaller than the entry in Matrix B.

What is the difference between matrix addition and subtraction?

Both operations work on corresponding entries of matrices with matching dimensions. Addition adds those entries, while subtraction takes each entry in B away from the corresponding entry in A.

Explore more matrix calculators

Continue with another matrix operation on Matrices.org.