Matrix Calculator

Perform matrix addition, subtraction, multiplication, determinant, inverse, and transpose. Supports 2×2, 3×3, and 4×4 matrices. Free, private, and runs entirely in your browser.

Matrix Input

Matrix A

Matrix B

Enter matrix values and click Calculate to see the result here.

Result

What does this matrix calculator do?

This free online matrix calculator performs the most common linear algebra operations on 2×2, 3×3, and 4×4 matrices. You can add, subtract, multiply matrices, find the determinant, compute the inverse, transpose a matrix, or multiply a matrix by a scalar. All calculations run instantly in your browser — no server, no signup, no data collection.

Matrix operations are fundamental in mathematics, engineering, physics, computer graphics, and machine learning. Whether you're solving systems of linear equations, transforming coordinates, or studying eigenvalues, a reliable matrix calculator saves time and eliminates arithmetic errors.

How to use the matrix calculator

  1. Select matrix size: Choose 2×2, 3×3, or 4×4 from the size selector.
  2. Choose an operation: Pick addition, subtraction, multiplication, scalar multiplication, determinant, inverse, or transpose.
  3. Enter matrix values: Type numbers into the grid cells. Use Tab to move between cells quickly.
  4. Calculate: Click the "Calculate" button. The result appears instantly in the result panel.
  5. Reset if needed: Use Clear to empty all cells, Identity to load an identity matrix, or Random to fill with random values.

For binary operations (addition, subtraction, multiplication), both Matrix A and Matrix B are shown. For unary operations (determinant, inverse, transpose, scalar multiplication), only Matrix A is used.

Why use this matrix calculator?

100% private

Everything runs in your browser. The numbers you enter never leave your device — no server, no logs, no tracking.

Multiple sizes

Supports 2×2, 3×3, and 4×4 matrices. Switch sizes instantly without losing your work.

Seven operations

Addition, subtraction, multiplication, scalar multiplication, determinant, inverse, and transpose.

Instant results

No server round-trip means your result appears the moment you click calculate. Zero waiting.

Clear error messages

Singular matrices, non-square inverses, and invalid inputs are explained clearly so you know what went wrong.

Works offline

Once the page loads, you can perform matrix calculations without an internet connection.

Matrix operations explained

Matrix addition and subtraction

To add or subtract two matrices, they must have the same dimensions. The operation is performed element by element: each entry in the result is the sum (or difference) of the corresponding entries in the two input matrices. For example, if A = [[1, 2], [3, 4]] and B = [[5, 6], [7, 8]], then A + B = [[6, 8], [10, 12]].

Matrix multiplication

Matrix multiplication is not element-wise. For two matrices A (m × n) and B (n × p), the product AB is an m × p matrix. Each entry (i, j) in the result is the dot product of row i of A and column j of B. This means the number of columns in A must equal the number of rows in B. Our calculator supports 2×2, 3×3, and 4×4 matrices of matching sizes.

Scalar multiplication

Multiplying a matrix by a scalar k means multiplying every entry in the matrix by k. For example, if k = 2 and A = [[1, 2], [3, 4]], then kA = [[2, 4], [6, 8]].

Determinant

The determinant is a scalar value computed from a square matrix. It tells you whether the matrix is invertible. If the determinant is zero, the matrix is singular and has no inverse. For a 2×2 matrix [[a, b], [c, d]], the determinant is ad − bc.

Inverse

The inverse of a square matrix A is a matrix A⁻¹ such that A × A⁻¹ = I, where I is the identity matrix. Only matrices with a non-zero determinant have an inverse. For a 2×2 matrix [[a, b], [c, d]], the inverse is (1 / (ad − bc)) × [[d, −b], [−c, a]].

Transpose

Transposing a matrix swaps its rows and columns. The element at row i, column j moves to row j, column i. For example, if A = [[1, 2, 3], [4, 5, 6]], then Aᵀ = [[1, 4], [2, 5], [3, 6]].

Where matrices are used

  • Computer graphics: Transformations like rotation, scaling, and translation are represented as matrices.
  • Machine learning: Neural networks rely heavily on matrix multiplication for forward and backward propagation.
  • Physics and engineering: Solving systems of linear equations, structural analysis, and quantum mechanics.
  • Economics: Input-output models and linear programming.
  • Statistics: Covariance matrices, regression analysis, and principal component analysis (PCA).
  • Cryptography: Hill cipher and other encryption schemes use matrix operations.

Frequently asked questions

Yes, completely free. No signup, no watermark, no hidden charges. Perform as many matrix calculations as you want.
It supports matrix addition, subtraction, multiplication, scalar multiplication, determinant, inverse, and transpose for 2×2, 3×3, and 4×4 matrices.
Absolutely. Everything runs in your browser using JavaScript. The numbers you enter never leave your device — there is no server processing, no logging, and no data storage.
No. Only square matrices (same number of rows and columns) have inverses. If the determinant is zero, the matrix is singular and has no inverse. The calculator will display a clear error message in that case.
The determinant is a scalar value computed from a square matrix. It tells you whether the matrix is invertible — if the determinant is zero, the matrix has no inverse. For a 2×2 matrix [[a, b], [c, d]], the determinant is ad − bc.
Transposing a matrix swaps its rows and columns. Element at row i, column j moves to row j, column i. For example, a 2×3 matrix becomes a 3×2 matrix after transposition.
For multiplication, the number of columns in the first matrix must equal the number of rows in the second matrix. This calculator supports 2×2, 3×3, and 4×4 matrices, so both matrices must be the same size for multiplication.
The calculator shows the final result clearly. For learning purposes, the content sections above explain the formulas and methods behind each operation — determinant, inverse, transpose, and so on.