Matrix Calculator

Add, subtract and multiply matrices, or find the transpose, determinant, inverse or power of a matrix, for any size from 2×2 to 5×5.

Instant Calculations
8 Operations
2×2 to 5×5
➕
Add/Subtract
✖️
Multiply
🔄
Transpose
📐
Determinant
Powered by orbit2x.com
×
×

Add, Multiply, Invert and Find the Determinant of a Matrix

This calculator works with matrices from 2×2 up to 5×5, square or rectangular. It does eight operations: addition, subtraction, multiplication, multiplication by a number (scalar), transpose, determinant, inverse and whole-number powers.

You get the result matrix, or the determinant as a single number, with values rounded to 4 decimal places. It shows the answer, not a worked solution, so it's best for checking homework or getting a quick result rather than learning the method. The sections below explain how each operation is done by hand.

How to Use the Matrix Calculator

  1. Choose an operation. Matrix B only appears for add, subtract and multiply; scalar and power ask for a number instead.
  2. Set the size of each matrix (rows × columns, 2 to 5 each).
  3. Type the values. Decimals and negative numbers are fine, and empty cells count as 0. Identity, Zeros, Ones and Random fill the whole matrix in one click.
  4. Calculate (or press Ctrl+Enter), then copy the result or print it.

The matrices are sent to the Orbit2x server to be calculated, and the result comes back to the page.

Which Matrices Work With Which Operations

Size rules for each matrix operation
OperationSize ruleResult size
A + B, A − BSame sizeSame as A
A × BColumns of A = rows of BRows of A × columns of B
k × AAny sizeSame as A
Transpose AᵀAny sizem×n becomes n×m
det(A)SquareA single number
Inverse A⁻¹Square, determinant not 0Same as A
Power AⁿSquare, n from 0 to 10Same as A

If the sizes don't fit, the calculator tells you why. For example, multiplying a 2×3 matrix by a 2×2 gives "columns of A (3) must equal rows of B (2)".

Worked Examples

All examples use A = [[1, 2], [3, 4]] and B = [[5, 6], [7, 8]], and match what the calculator returns.

Multiplying two matrices

Each entry of A × B is a row of A times a column of B, multiplied pairwise and added. The top-left entry is 1×5 + 2×7 = 19.

A × B = [[19, 22], [43, 50]] B × A = [[23, 34], [31, 46]]

The two products are different: matrix multiplication isn't commutative, so the order matters.

Determinant of a 2×2 matrix

For [[a, b], [c, d]] the determinant is ad − bc.

det(A) = 1×4 − 2×3 = −2

Inverse of a 2×2 matrix

Swap a and d, change the signs of b and c, and divide everything by the determinant.

A⁻¹ = 1/(−2) × [[4, −2], [−3, 1]] = [[−2, 1], [1.5, −0.5]]

Check: A × A⁻¹ gives the identity matrix [[1, 0], [0, 1]].

Determinant of a 3×3 matrix

The calculator expands along the first row: each entry times the determinant of the 2×2 left when you cross out its row and column, with signs alternating +, −, +.

C = [[2, −3, 1], [2, 0, −1], [1, 4, 5]] det(C) = 2(0×5 − (−1)×4) − (−3)(2×5 − (−1)×1) + 1(2×4 − 0×1) = 2(4) + 3(11) + 8 = 49

Transpose of a rectangular matrix

[[1, 2, 3], [4, 5, 6]]ᵀ = [[1, 4], [2, 5], [3, 6]]

A power that gives Fibonacci numbers

[[1, 1], [1, 0]]¹⁰ = [[89, 55], [55, 34]]

The entries are the 11th, 10th and 9th Fibonacci numbers. A⁰ is always the identity matrix.

How It Calculates, and Its Limits

  • Determinant: cofactor expansion along the first row, applied recursively. With ordinary whole-number input the determinant comes out exact.
  • Inverse: Gauss–Jordan elimination with partial pivoting (it swaps in the row with the largest value at each step to reduce rounding error). If the determinant is 0, or within 10⁻¹⁰ of it, the matrix is treated as singular and has no inverse.
  • Power: repeated squaring, so A¹⁰ takes 6 matrix multiplications instead of 9.
  • Rounding: values are calculated as 64-bit floating-point numbers and shown to 4 decimal places. Fractions like 1/3 appear as 0.3333, and very small leftovers from rounding (below 10⁻¹⁰) are shown as 0.
  • Not included: eigenvalues, rank, row echelon form, LU decomposition, or solving Ax = b directly. To solve a system you can multiply A⁻¹ by the column of constants, as shown below.

Frequently Asked Questions

Why can't my matrix be inverted?

Its determinant is 0, which makes it singular. That happens when one row (or column) is a multiple or combination of others. [[1, 2], [2, 4]] is singular because the second row is twice the first.

Can I multiply matrices of different sizes?

Yes, as long as the number of columns in A equals the number of rows in B. A 2×3 times a 3×2 gives a 2×2: [[1, 2, 3], [4, 5, 6]] × [[7, 8], [9, 10], [11, 12]] = [[58, 64], [139, 154]].

How do I solve a system of equations with this calculator?

Write the system as Ax = b. Find A⁻¹ with the inverse operation, then multiply A⁻¹ by b. The calculator's smallest matrix is 2×2, so enter b with 0 in the second column and read the answer from the first column. For 4x + 7y = 1 and 2x + 6y = 0, A⁻¹ = [[0.6, −0.7], [−0.2, 0.4]], giving x = 0.6 and y = −0.2.

What does the determinant tell me?

Whether the matrix can be inverted (only when it isn't 0), and how much the matrix scales area (2×2) or volume (3×3). A negative determinant means the transformation also flips orientation.

Why does my answer show 0.3333 instead of 1/3?

The calculator works in decimals, not fractions, and rounds the displayed values to 4 decimal places.

Related Tools