Matrix

Matrix A

RowsColumns
12
12

Matrix B

RowsColumns
12
12

Applying Matrix Algebra Rules to a Resizable Grid

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.

Key Factors to Consider

  • Matrix multiplication is generally NOT commutative — order matters. Unlike ordinary number multiplication, AB usually does not equal BA for matrices, and one order may not even be mathematically valid if the dimensions don’t line up the right way — always keep track of which matrix goes first.
  • A zero determinant means a square matrix is “singular” and has no inverse. This is a common reason a matrix operation elsewhere fails (like trying to solve a system of linear equations) — a nonzero determinant is required for the matrix to be invertible.
  • Matrices are the standard tool behind linear transformations in computer graphics, physics, and engineering. Rotating, scaling, and shearing a 2D or 3D shape (common in game development and animation) are all expressed as matrix multiplication against a set of coordinate points.
  • Matrix dimensions are always written rows × columns, and this order matters for compatibility. A 2×3 matrix has 2 rows and 3 columns — for multiplication to be valid, the first matrix’s column count must match the second matrix’s row count, which is why AB can be valid while BA is not, even when both matrices are otherwise compatible in shape.

Common Mistakes

  • Multiplying matrices entry-by-entry instead of using the row-times-column rule. Matrix multiplication is not the same operation as addition or subtraction — each result entry is a dot product of a whole row and a whole column, not a single pairwise multiplication.
  • Assuming AB and BA give the same result. Matrix multiplication is generally not commutative, and reversing the order can produce a completely different result — or not even be mathematically valid if the dimensions no longer line up.
  • Trying to find a determinant of a non-square matrix. The determinant is only defined for square matrices (same number of rows and columns) — a 2×3 or 3×2 matrix simply doesn’t have one.
  • Mixing up a matrix’s dimensions when checking compatibility. A matrix’s size is always rows × columns, in that order — confusing which number is which is a common source of “why won’t this multiplication work” confusion.

Useful to Know

  • Working with a system of equations that a matrix represents? Quadratic Formula Calculator handles the single-variable case directly if that’s what you actually need.
  • Need trigonometric, logarithmic, or other functions alongside matrix operations? Scientific Calculator covers that broader toolkit.
  • Working with a large dataset instead of a small matrix? Statistics Calculator computes mean, median, and standard deviation from a list of numbers directly.

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.

Confirm Your Age

To create an account, please tell us your birth month and year.