Skip to content
UniKit

Matrix calculator

Add, subtract, multiply, transpose, scale matrices and compute determinants or inverses, with newline/space separated input and aligned output.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Result

Fill in the matrices to compute a result

What this tool does

  • Check linear algebra homework: add, subtract, multiply, transpose and scale matrices, and compute determinants or inverses, with the result column-aligned so it is easy to copy by hand.
  • Sanity-check a matrix implementation: multiplication and Gauss-Jordan elimination are hand-written here, so you can compare them against your own code when a transpose or index order looks wrong.
  • See whether a square matrix is invertible before an exam: read the determinant first, then the inverse — a singular matrix reports "not invertible (determinant is 0)" instead of spitting out NaN.
  • Compute straight from text: paste numbers from a spreadsheet or source file and spaces, commas and newlines are all accepted, so nothing has to be typed cell by cell.

Example

Input

A =
1 2 3
4 5 6

B =
7 8
9 10
11 12

Operation: A × B

Output

 58   64
139  154

The result is plain text where the leading spaces are padding used to align columns; strip them before pasting into code.

Frequently asked questions

Why does A × B work while B × A reports a dimension mismatch?

Matrix multiplication is not commutative. With A being 2×3 and B being 3×2, A×B is a valid 2×2 product, but B×A would need the left matrix column count to equal the right matrix row count — 2 ≠ 3 here. The tool reports "the matrices have incompatible shapes".

Why do determinants and inverses require a square matrix?

Both are only defined for n×n matrices, so a non-square input reports "determinants and inverses require a square matrix". For a rectangular matrix, work with a square form such as AᵀA instead.

The inverse came out as decimals like 0.6 and -0.2 — how do I verify it?

Multiply it by the original matrix and you should get the identity. Values are rounded to 12 significant digits and -0 is normalised to 0, so you will not see artefacts like 1.0000000000000002 or -0.

Can I enter fractions, percentages or scientific notation?

Fractions and percent signs are not supported. Every cell must be a plain number, and 1.5, .5, +3, -2 and 1e-3 are all accepted. Letters or other characters produce "unrecognised number".

Is my matrix data uploaded anywhere?

No. Parsing and every operation run in your browser as plain JavaScript, the page makes no network requests, it works offline and the input is never logged.

Keywords:矩阵matrix行列式determinant逆矩阵inverse转置transpose线性代数

Related tools