Matrix Calculator

Perform all essential matrix operations — add, subtract, multiply, transpose, and find the determinant — in one free online linear algebra tool.

Select an operation, enter one or two matrices in semicolon-and-comma format, and click Calculate for instant results.

Matrix Calculator
Perform all essential matrix operations — add, subtract, multiply, transpose, and find the determinant — in one free online linear algebra tool.

Separate rows with semicolons (;) and columns with commas (,). Example: 1,2;3,4 represents a 2×2 matrix.

About the matrix calculator

A matrix is a rectangular array of numbers arranged in rows and columns. Matrices are the fundamental data structure of linear algebra, and virtually every problem in physics, engineering, computer graphics, statistics, and machine learning can be expressed in terms of matrices and the operations performed on them. This calculator covers the five operations you will encounter most often: addition, subtraction, multiplication, transpose, and determinant. Matrix addition and subtraction are element-wise operations that require both matrices to have identical dimensions. You combine corresponding elements position by position, producing a result matrix of the same size. Subtraction simply uses a minus sign instead of a plus sign at each position. Matrix multiplication is more complex. To multiply an m×n matrix A by an n×p matrix B, the number of columns in A must equal the number of rows in B. Each element of the resulting m×p matrix is computed as the dot product of a row from A and a column from B: C[i][j] = Σ A[i][k] × B[k][j]. Unlike ordinary multiplication, matrix multiplication is not commutative — AB ≠ BA in general. The transpose of a matrix is obtained by swapping its rows and columns. If A is an m×n matrix, its transpose Aᵀ is an n×m matrix where Aᵀ[i][j] = A[j][i]. Transposing is fundamental in many formulas, including the computation of covariance matrices in statistics and the formulation of normal equations in linear regression. The determinant is a scalar value associated with a square matrix that encodes important geometric and algebraic information. For a 2×2 matrix [[a,b],[c,d]], det = ad − bc. For larger matrices the calculation involves recursive cofactor expansion or row reduction. A non-zero determinant means the matrix is invertible; a zero determinant means it is singular and has no inverse. Together these five operations cover the vast majority of what students and professionals need in a day-to-day linear algebra context. Whether you are solving systems of equations, rotating objects in 3D graphics, fitting regression models, or analyzing network graphs, understanding how to add, subtract, multiply, transpose, and take the determinant of matrices gives you a powerful toolkit for tackling almost any quantitative problem.

Matrix calculator examples

Five examples illustrating each of the five supported operations.

InputResultNotes
Add: A = [[1,2],[3,4]], B = [[5,6],[7,8]][[6,8],[10,12]]Element-wise addition. Both matrices must be the same size.
Multiply: A = [[1,2],[3,4]], B = [[2,0],[1,2]][[4,4],[10,8]]C[0][0] = 1×2 + 2×1 = 4. C[0][1] = 1×0 + 2×2 = 4. C[1][0] = 3×2 + 4×1 = 10. C[1][1] = 3×0 + 4×2 = 8.
Transpose: A = [[1,2,3],[4,5,6]][[1,4],[2,5],[3,6]]The 2×3 matrix becomes a 3×2 matrix. Rows become columns.
Determinant: A = [[3,8],[4,6]]−14det = 3×6 − 8×4 = 18 − 32 = −14. A non-zero determinant means A is invertible.
Subtract: A = [[9,5],[3,7]], B = [[4,2],[1,3]][[5,3],[2,4]]Each element of B is subtracted from the corresponding element of A.

How to use the matrix calculator

  1. Click the operation button — Add, Subtract, Multiply, Transpose, or Determinant — to select the calculation you want to perform.
  2. Enter Matrix A in the first field using semicolons to separate rows and commas to separate values within a row. For example, 1,2;3,4 represents [[1,2],[3,4]].
  3. For Add, Subtract, and Multiply, also enter Matrix B in the second field. For Transpose and Determinant only Matrix A is required.
  4. Click Calculate. The result appears below — as a matrix for Add, Subtract, Multiply, and Transpose, or as a single number for Determinant.
  5. Click Reset to clear all fields and start over, or switch operations to reuse the same matrices for a different calculation.

Frequently asked questions

When can two matrices be multiplied?
Two matrices A and B can be multiplied (as A × B) only when the number of columns in A equals the number of rows in B. If A is m×n and B is n×p, the product C is m×p. If the inner dimensions do not match, the multiplication is undefined and the calculator will show a dimension error.
Is matrix multiplication commutative?
No. In general, AB ≠ BA, even when both products are defined. This is one of the most important ways matrices differ from ordinary numbers. For example, if A rotates vectors by 90° and B reflects them, the order of operations produces a different transformation.
What does it mean if the determinant is zero?
A zero determinant means the matrix is singular — it has no inverse and its rows (or columns) are linearly dependent. Geometrically, it means the matrix collapses space onto a lower-dimensional object. In systems of equations, a singular coefficient matrix means the system either has no solution or infinitely many solutions.
How do I enter a non-square matrix?
Use the standard format: separate row elements with commas and separate rows with semicolons. For example, a 2×3 matrix [[1,2,3],[4,5,6]] is entered as 1,2,3;4,5,6. Non-square matrices are valid for addition, subtraction, multiplication, and transpose, but not for the determinant.
What is the transpose used for?
The transpose swaps rows and columns of a matrix. It is used in many linear algebra formulas: computing dot products, forming symmetric matrices, solving least-squares problems via the normal equations (AᵀA)x = Aᵀb, and finding the conjugate transpose in complex analysis. In machine learning, transposing weight matrices is routine in neural network forward and backward passes.
Can this calculator handle matrices larger than 3×3?
Yes. The calculator supports matrices of any consistent dimensions for all operations. Determinants of large matrices are computed using Gaussian elimination, which is accurate for matrices up to at least 10×10. For very large matrices, numerical precision may decrease slightly due to floating-point arithmetic.