Matrix Calculator

Matrix A

RowsColumns
12
12

Matrix B

RowsColumns
12
12

Result

12
12
0
0
0
0

How This Calculator Works

A matrix is a rectangular grid of numbers that can be added, subtracted, multiplied, or transformed as a single unit, following its own set of algebra rules distinct from ordinary arithmetic. Pick an operation, build Matrix A (and Matrix B, if the operation needs it) using the +/- row and column buttons to resize each grid to whatever dimensions you need, and this calculator applies the matching rule.

Addition and subtraction require both matrices to be exactly the same size. Multiplication requires Matrix A’s column count to match Matrix B’s row count (the result takes Matrix A’s row count and Matrix B’s column count). The determinant only exists for a square matrix (same number of rows and columns). Transpose works on a matrix of any shape, flipping its rows and columns.

This calculator doesn’t attempt row reduction, matrix inverses, or eigenvalues — a genuinely different, much larger undertaking than the operations here.

The Formula

The examples below use 2x2 matrices to illustrate each rule clearly — the same rules extend directly to any size matrix the grid above supports. Let Matrix A have entries a11,a12,a21,a22\vA{a_{11}}, \vA{a_{12}}, \vA{a_{21}}, \vA{a_{22}} and Matrix B have entries b11,b12,b21,b22\vB{b_{11}}, \vB{b_{12}}, \vB{b_{21}}, \vB{b_{22}}, each written as

A=[a11a12a21a22],B=[b11b12b21b22]A = \begin{bmatrix} \vA{a_{11}} & \vA{a_{12}} \\ \vA{a_{21}} & \vA{a_{22}} \end{bmatrix}, \quad B = \begin{bmatrix} \vB{b_{11}} & \vB{b_{12}} \\ \vB{b_{21}} & \vB{b_{22}} \end{bmatrix}
  • Addition/Subtraction combine matching positions one at a time: A±B=[a11±b11a12±b12a21±b21a22±b22]A \pm B = \begin{bmatrix} \vA{a_{11}} \pm \vB{b_{11}} & \vA{a_{12}} \pm \vB{b_{12}} \\ \vA{a_{21}} \pm \vB{b_{21}} & \vA{a_{22}} \pm \vB{b_{22}} \end{bmatrix}
  • Multiplication is NOT element-wise — each entry of the result is a “row times column” dot product: AB=[a11b11+a12b21a11b12+a12b22a21b11+a22b21a21b12+a22b22]AB = \begin{bmatrix} \vA{a_{11}}\vB{b_{11}} + \vA{a_{12}}\vB{b_{21}} & \vA{a_{11}}\vB{b_{12}} + \vA{a_{12}}\vB{b_{22}} \\ \vA{a_{21}}\vB{b_{11}} + \vA{a_{22}}\vB{b_{21}} & \vA{a_{21}}\vB{b_{12}} + \vA{a_{22}}\vB{b_{22}} \end{bmatrix}
  • Determinant is a single number describing how much the matrix scales area: det(A)=a11a22a12a21\det(A) = \vA{a_{11}}\vA{a_{22}} - \vA{a_{12}}\vA{a_{21}}
  • Transpose flips the matrix across its main diagonal, swapping the two off-diagonal entries: AT=[a11a21a12a22]A^T = \begin{bmatrix} \vA{a_{11}} & \vA{a_{21}} \\ \vA{a_{12}} & \vA{a_{22}} \end{bmatrix}

Worked Example

Using A=[1234]A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} and B=[5678]B = \begin{bmatrix} 5 & 6 \\ 7 & 8 \end{bmatrix}:

  1. Addition: A+B=[1+52+63+74+8]=[681012]A + B = \begin{bmatrix} 1+5 & 2+6 \\ 3+7 & 4+8 \end{bmatrix} = \begin{bmatrix} 6 & 8 \\ 10 & 12 \end{bmatrix}.
  2. Multiplication: the top-left entry is 1×5+2×7=191 \times 5 + 2 \times 7 = 19, the top-right is 1×6+2×8=221 \times 6 + 2 \times 8 = 22, the bottom-left is 3×5+4×7=433 \times 5 + 4 \times 7 = 43, and the bottom-right is 3×6+4×8=503 \times 6 + 4 \times 8 = 50, giving AB=[19224350]AB = \begin{bmatrix} 19 & 22 \\ 43 & 50 \end{bmatrix}.
  3. Determinant of A: 1×42×3=21 \times 4 - 2 \times 3 = -2.

Source: Standard 2x2 matrix algebra.

Frequently Asked Questions

Why is matrix multiplication not element-wise?

Matrix multiplication combines a "row" of the first matrix with a "column" of the second, multiplying and summing pairs of entries — not simply multiplying entries in the same position the way addition and subtraction do. This "row times column" rule is what makes matrix multiplication generally NOT commutative (A x B usually does not equal B x A), unlike ordinary number multiplication.

What does the determinant tell you?

The determinant is a single number describing how much a matrix scales area when it transforms a shape. A determinant of zero means the matrix squashes everything onto a line (or a point) — it has no inverse.

Does this calculator support matrices larger than 2x2?

Yes — use the +/- row and column buttons on each matrix grid to resize it to whatever dimensions you need (up to 8x8). Addition and subtraction require both matrices to be the same size; multiplication requires Matrix A's column count to match Matrix B's row count; the determinant requires a square matrix.