Matrix calculator

What is a Matrix Calculator?

Matrices are rectangular grids of numbers used throughout linear algebra, computer graphics, statistics, machine learning and engineering. This calculator performs the common operations: addition, subtraction, multiplication, transpose, determinant and inverse, so you can check homework, verify code or solve small systems of equations.

How to use it

  1. Set the dimensions of matrix A, and of matrix B if the operation needs two.
  2. Enter the values.
  3. Choose the operation and read the result.

Rules to remember

  • Addition and subtraction need matrices of the same size.
  • Multiplication A × B needs the number of columns of A to equal the number of rows of B. A 2×3 times a 3×4 gives a 2×4 result. Matrix multiplication is not commutative: A × B is usually different from B × A.
  • Determinant and inverse exist only for square matrices, and the inverse exists only when the determinant is not zero.

Worked example

For A = [[4, 7], [2, 6]]:

  • Determinant = 4 × 6 - 7 × 2 = 10.
  • Inverse = (1 / 10) × [[6, -7], [-2, 4]] = [[0.6, -0.7], [-0.2, 0.4]].
  • Transpose = [[4, 2], [7, 6]].

Check: A × A⁻¹ = [[4×0.6 + 7×(-0.2), 4×(-0.7) + 7×0.4], ...] = [[1, 0], [0, 1]], the identity matrix.

Practical uses

  • Solving linear systems: Ax = b gives x = A⁻¹b.
  • 2D and 3D graphics: rotation, scaling and translation are matrix multiplications.
  • Statistics: covariance matrices and linear regression.

Numerical caution

A determinant very close to zero means the matrix is nearly singular, and its inverse will contain huge values that amplify rounding errors.

Frequently Asked Questions

When can two matrices be multiplied?

When the number of columns in the first matrix equals the number of rows in the second.

Why does my matrix have no inverse?

Its determinant is zero, which means it is singular. Only square matrices with a non-zero determinant are invertible.

Is A times B the same as B times A?

Usually not. Matrix multiplication is not commutative.

What is a transpose?

The matrix flipped over its diagonal, so rows become columns and columns become rows.