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

Worked Example

For A = [1, 2; 3, 4] and B = [5, 6; 7, 8]:

Matrix subtraction, cell by cell
PositionCalculationResult
Row 11−5, 2−6−4, −4
Row 23−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

  1. Choose the matrix size: 2 x 2 Matrices or 3 x 3 Matrices.
  2. Enter each cell of Matrix A.
  3. Enter each cell of Matrix B, which will be subtracted from A.
  4. 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.