Subtract two matrices
Matrix A minus Matrix B. Both matrices must have identical dimensions. Supports matrices from 1 × 1 to 8 × 8.
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.
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
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.