Matrix Calculator

🌐 English
A (3×3)
Rows: 3
Cols: 3
B (3×3)
Rows: 3
Cols: 3
Supports: fractions (1/2), decimals (0.5), constants (pi, e). Empty cells are treated as 0.

Calculation Results

Practice This Skill

Generate printable matrix addition and subtraction practice problems with exact answer keys and detailed solutions.

Practice Matrix Addition & Subtraction →

Matrix Subtraction — Definition, Formula, Examples & Practice

Learn how to subtract matrices, see step-by-step worked examples, avoid common mistakes, and practice with problems. All matrices are rendered with MathJax for clear presentation.

1. What is a matrix?

A matrix is a rectangular array of numbers arranged in rows and columns. Matrices are commonly used in linear algebra, computer graphics, data science, and many applications of engineering and physics. A matrix with m rows and n columns is called an m × n matrix.

Example of a general \(m\times n\) matrix: \[ A = \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{bmatrix} \]

2. Matrix subtraction: definition and formula

Matrix subtraction is defined only for two matrices of the same dimensions. If \(A = [a_{ij}]\) and \(B = [b_{ij}]\) are both \(m\times n\) matrices, then their difference is

\[ A - B = [\,a_{ij} - b_{ij}\,] \quad\text{for } 1 \le i \le m,\; 1 \le j \le n. \]

Important: If the matrices have different numbers of rows or columns, subtraction is not defined.

3. Worked examples

Example 1 — Basic 2×2 subtraction

Given

\[ A = \begin{bmatrix} 3 & 5 \\ 2 & 7 \end{bmatrix}, \quad B = \begin{bmatrix} 1 & 4 \\ 6 & 2 \end{bmatrix} \]

Compute \(A - B\).

Subtract corresponding elements: \[ A - B = \begin{bmatrix} 3-1 & 5-4 \\ 2-6 & 7-2 \end{bmatrix} = \begin{bmatrix} 2 & 1 \\ -4 & 5 \end{bmatrix} \]

Example 2 — Subtraction with negatives (2×3 matrices)

Given

\[ A = \begin{bmatrix} 0 & -3 & 5 \\ 2 & 4 & -1 \end{bmatrix}, \quad B = \begin{bmatrix} -2 & 6 & 1 \\ 3 & 0 & -4 \end{bmatrix} \]

Compute \(A - B\).

Compute each component: \[ A - B = \begin{bmatrix} 0 - (-2) & -3 - 6 & 5 - 1 \\ 2 - 3 & 4 - 0 & -1 - (-4) \end{bmatrix} = \begin{bmatrix} 2 & -9 & 4 \\ -1 & 4 & 3 \end{bmatrix} \]

4. Common mistakes to avoid

  • Not checking dimensions: Always verify both matrices have the same number of rows and columns before subtracting.
  • Reversing the order: Matrix subtraction is not commutative: \(A - B \ne B - A\) in general.
  • Mis-handling negative signs: Remember \(a - (-b) = a + b\).
  • Reading the wrong entry: For larger matrices double-check row and column indices (e.g., \(a_{23}\) is row 2, column 3).

5. Practice problems (try them first — answers are hidden)

  1. Problem 1
    \[ \begin{bmatrix} 4 & 7 \\ 1 & 3 \end{bmatrix} - \begin{bmatrix} 2 & 1 \\ 5 & 0 \end{bmatrix} \]
    Show answer
    \[ \begin{bmatrix} 4-2 & 7-1 \\ 1-5 & 3-0 \end{bmatrix} = \begin{bmatrix} 2 & 6 \\ -4 & 3 \end{bmatrix} \]
  2. Problem 2
    \[ \begin{bmatrix} -1 & 6 & 2 \\ 0 & 3 & -4 \end{bmatrix} - \begin{bmatrix} 2 & -2 & 5 \\ 1 & 0 & -1 \end{bmatrix} \]
    Show answer
    Subtract element-wise: \[ \begin{bmatrix} -1-2 & 6-(-2) & 2-5 \\ 0-1 & 3-0 & -4-(-1) \end{bmatrix} = \begin{bmatrix} -3 & 8 & -3 \\ -1 & 3 & -3 \end{bmatrix} \]
  3. Problem 3
    \[ \begin{bmatrix} 10 & 0 \\ -3 & 7 \\ 5 & 1 \end{bmatrix} - \begin{bmatrix} 4 & 2 \\ 1 & -5 \\ 0 & 3 \end{bmatrix} \]
    Show answer
    \[ \begin{bmatrix} 10-4 & 0-2 \\ -3-1 & 7-(-5) \\ 5-0 & 1-3 \end{bmatrix} = \begin{bmatrix} 6 & -2 \\ -4 & 12 \\ 5 & -2 \end{bmatrix} \]
  4. Problem 4 (slightly harder)
    \[ \begin{bmatrix} 3 & -1 & 4 \\ 2 & 8 & 0 \\ -5 & 1 & 7 \end{bmatrix} - \begin{bmatrix} 1 & 3 & -2 \\ -2 & 0 & 6 \\ 4 & -3 & 1 \end{bmatrix} \]
    Show answer
    Subtract each corresponding entry: \[ \begin{bmatrix} 3-1 & -1-3 & 4-(-2) \\ 2-(-2) & 8-0 & 0-6 \\ -5-4 & 1-(-3) & 7-1 \end{bmatrix} = \begin{bmatrix} 2 & -4 & 6 \\ 4 & 8 & -6 \\ -9 & 4 & 6 \end{bmatrix} \]

6. Quick tips for using a matrix subtraction calculator

  • Always verify the input matrix sizes shown on the page before computing.
  • If your calculator accepts CSV or pasted rows, make sure you separate rows consistently (commas, spaces or new lines as required).
  • For teaching, present subtraction step-by-step: show original matrices side-by-side and highlight corresponding entries.

© 2025 Example Matrix Tools — Matrix subtraction tutorial and practice. Built for clarity and search-friendly structure.

Learn matrix multiplication more easily in just 2 minutes with this free game.

Matrix Multiplication Game