Matrix Subtraction Calculator

Enter the entries of matrices A and B to compute A − B.

How it is calculated

Both matrices are 2×2, with entries named by row and column (a12 is row 1, column 2). The difference C = A − B is built entry by entry: c11 = a11 − b11, c12 = a12 − b12, c21 = a21 − b21, c22 = a22 − b22. The tool then reports two numbers for C: the determinant det = c11·c22 − c12·c21 and the trace trace = c11 + c22. All eight fields must be filled in; a blank field gives no result. Values may be negative or decimal, and everything is shown with two decimals. Order matters: A − B is the negative of B − A.

Worked example

Take A = [5 3; 2 7] and B = [1 4; 6 2]. Subtract position by position: 5 − 1 = 4, 3 − 4 = −1, 2 − 6 = −4, 7 − 2 = 5. The result is [4.00 -1.00; -4.00 5.00], written row by row with a semicolon between rows. Determinant: 4 × 5 − (−1) × (−4) = 20 − 4 = 16.00. Trace: 4 + 5 = 9.00.

Try this example →

Common mistakes

  • Swapping the order. A − B and B − A give matrices with opposite signs; the determinant stays the same for 2×2 but the matrix and the trace flip sign.
  • Entering a row as a column. The fields are row-major: the second box in the first row is the 1,2 entry, not the 2,1 entry.
  • Dropping the minus sign when subtracting a negative. With b12 = −3, a12 − b12 becomes a12 + 3.
  • Expecting matrix multiplication rules. Subtraction works entry by entry and needs matching sizes, so there is no row-by-column step here.
  • Mixing up the determinant with the trace. The determinant uses the diagonal products minus the off-diagonal products; the trace is just the sum of the two diagonal entries.

About this calculator

Subtracting two matrices of the same size is done element-wise: each entry in the result equals the entry in matrix A minus the entry in the same position in matrix B, so for 2×2 matrices, C₁₁ = A₁₁ − B₁₁, and so on for each of the four positions. It’s one of the most basic operations in linear algebra, alongside addition and scalar multiplication.

Students, engineers, and programmers use matrix subtraction constantly — in computer graphics to find the difference between transformation states, in statistics to compute deviations, and in control systems to measure error between a target and actual state matrix. This calculator subtracts your entered 2×2 matrices B from A and also reports the resulting matrix’s determinant (ad − bc) and trace (sum of the diagonal entries).

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    Of the two figures shown for the difference, only the trace behaves simply: trace of A minus B equals trace A minus trace B. The determinant does not. With the default matrices, det A is 31 and det B is minus 10, so subtracting them gives 41, yet the determinant of A minus B is 36. A determinant of zero means the difference cannot be inverted. Do you need larger matrices than 2 by 2?

Popular calculators

All Calculators