Matrix Subtraction Calculator
Finding the Difference, Cell by Cell
Matrix subtraction mirrors addition exactly, just with the operation flipped: each entry in the second matrix is subtracted from the matching entry in the first. Order matters here in a way it doesn't for addition — A minus B is not the same result as B minus A.
The Formula
C = A − B (element-wise subtraction)
Cij = Aij − Bij
Cij = Aij − Bij
Worked Example
For A = [1, 2; 3, 4] and B = [5, 6; 7, 8]:
| Position | Calculation | Result |
|---|---|---|
| Row 1 | 1−5, 2−6 | −4, −4 |
| Row 2 | 3−7, 4−8 | −4, −4 |
Result matrix: [−4, −4; −4, −4].
Where This Matters
- Change detection — subtracting a "before" data matrix from an "after" matrix isolates exactly what changed, cell by cell.
- Error and residual analysis — comparing a predicted-values matrix against actual measurements to find the residual error matrix.
- Image differencing — subtracting two frames of pixel data highlights motion or changes between them.
How to Use This Calculator
- Choose the matrix size: 2 x 2 Matrices or 3 x 3 Matrices.
- Enter each cell of Matrix A.
- Enter each cell of Matrix B, which will be subtracted from A.
- Select Calculate to get the difference matrix.
Related Calculations
Need to add instead? Use the Matrix Addition Calculator, or check either matrix's determinant with the Matrix Determinant Calculator.