Skip to content

Matrix Subtraction Calculator

Subtract two matrices of the same size, entry by entry, with the working shown.

AvailableRuns in your browserFree · No sign-up

Matrix Subtraction Calculator

Matrix A (2 × 2)
Rows2
Columns2
Matrix B (2 × 2)
Rows2
Columns2

Calculations use full double precision; this only affects display.

Fill in both matrices (or load the examples). Decimals, negatives and fractions such as 3/4 are accepted.

How matrix subtraction works

C = A − B,   cij = aij − bij

Subtract each entry of B from the entry in the same position of A. Both matrices must have the same number of rows and columns; the result has those dimensions too. Unlike multiplication, the order matters only by sign: A − B = −(B − A).

Your data is processed locally in your browser and is not uploaded to OZVILO servers.

How to use the Matrix Subtraction Calculator

  1. 1Set the size of matrices A and B and fill them in, paste them as text, or load the examples.
  2. 2Make sure both have the same number of rows and columns.
  3. 3Read C = A − B, with the working for every entry.
  4. 4Copy the result or download it as CSV.

Examples

  • 2 × 3 matrices

    Input
    A = [[5, −2, 3.5], [0, 4, −1]], B = [[1, 3, 0.5], [−2, 4, 6]]
    Result
    A − B = [[4, −5, 3], [2, 0, −7]]
  • Different sizes

    Input
    A is 2 × 2, B is 2 × 3
    Result
    Explains that the sizes must match

Matrix Subtraction Calculator features

  • Matrices up to 8 × 8
  • Fractions such as 3/4
  • Entry-by-entry working
  • Copy and CSV export

Frequently asked questions

How do you subtract matrices?

Subtract the entries in matching positions: (A − B)ᵢⱼ = aᵢⱼ − bᵢⱼ. The result has the same size as A and B.

Can I subtract matrices of different sizes?

No. Subtraction is only defined for matrices with the same number of rows and columns. The tool tells you which dimensions differ.

Is A − B the same as B − A?

No — they're negatives of each other: B − A = −(A − B). Every entry changes sign.