ZestCalc

Matrix Addition and Subtraction Calculator

Add, subtract, and scale matrices up to 12×12 in exact fractions. Compute any αA ± βB and see each entry combine.

Matrices

A and B always share a size, because entries are combined position by position. Resize either one, and the other follows.

Up to 12 rows and 12 columns.

Use integers, decimals, or fractions such as 1/3. Paste rows from a spreadsheet or a Python list into any cell.

Combination

To multiply one matrix by a number, set the other's multiplier to 0.

Input

A=[123456]A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix}
B=[6543212]B = \begin{bmatrix} 6 & 5 & 4 \\ 3 & 2 & \frac{1}{2} \end{bmatrix}

Result

Updates as you type.

Entry by entry

AA
123456
BB
654321/2
CC
······

Each entry of the result uses only the entries in the same position of A and B. Step through to combine them.

Step 0 of 6

How to add and subtract matrices

Two matrices of the same size combine position by position. The entry in row ii, column jj of the result uses only the entries in that same position:

(A+B)ij=aij+bij,(A−B)ij=aij−bij(A + B)_{ij} = a_{ij} + b_{ij}, \qquad (A - B)_{ij} = a_{ij} - b_{ij}

The sizes have to match, because otherwise some positions have no partner. That's why this calculator keeps A and B the same size. Multiplication has a different rule, which the Matrix Multiplication Calculator covers.

Scalar multiplication and combinations

Multiplying a matrix by a number scales every entry. Together with addition, this gives every combination:

(αA+βB)ij=αaij+βbij(\alpha A + \beta B)_{ij} = \alpha a_{ij} + \beta b_{ij}

To scale a single matrix here, set the other's multiplier to 00. Fractions stay exact, so 13A\frac{1}{3}A never picks up rounding error.

Rules worth knowing

Matrix addition behaves like adding numbers:

  • Order doesn't matter. A+B=B+AA + B = B + A, unlike multiplication.
  • Grouping doesn't matter. (A+B)+C=A+(B+C)(A + B) + C = A + (B + C).
  • Zero changes nothing. Adding the zero matrix leaves AA as it is.
  • Scaling distributes. α(A+B)=αA+αB\alpha(A + B) = \alpha A + \alpha B.

Addition also pairs well with the Matrix Transpose Calculator: (A+B)T=AT+BT(A + B)^T = A^T + B^T. However, the determinant doesn't add, so det⁡(A+B)\det(A + B) usually isn't det⁡A+det⁡B\det A + \det B. Try it with the Determinant Calculator.