Pick a card on the first screen, Single Matrix, Two Matrices or Scalar Operations, then an operation in the Category column on the left. Learn more about choosing an operation
Set Rows and Cols (1 to 10); every matrix takes the size, and square-only operations grey out while the two differ. Learn more about the matrix size
Type the cells of Matrix A (and Matrix B), or use Random, Clear, Fill All and Diagonal with the Value box; for scalar operations type the Scalar value. Learn more about entering matrices
Click Execute Operation; a red box lists any problem, otherwise the Result box shows a number, a matrix or the three matrices of a decomposition. Reset All returns to the first screen. Learn more about the result
Read the panel on the right: the operation's description, the Calculation Steps after an Execute, and the History of this visit. Learn more about the panel
The calculator opens on Select Operation Type with three cards: Single Matrix (determinant, transpose, inverse, trace, rank), Two Matrices (addition, subtraction, multiplication and more) and Scalar Operations (scalar multiplication, addition, power). Clicking a card moves to the input screen, which has three columns: the Category list on the left with the operations of the chosen category under it, the Matrix Input card in the middle and the explanation panel on the right. One matrix is created for a single-matrix or scalar category, two for the two-matrix category, all at the current size.
Click an operation in the left column to select it; a dot marks the choice, the panel heading takes the operation's name, and any earlier result is cleared. Click another category in the same column to switch; the operation list changes and the matrices are rebuilt, so values typed for the old category are lost. Operations that need a square matrix are greyed out while the size boxes differ. Reset All at the top right returns to the first screen with the size back at 3×3. What each category contains is explained in Single-Matrix Operations, Two-Matrix Operations and Scalar Operations.
Setting the Matrix Size
Demo2×2, then 2×3, then Reset All
Step 0 of 3
The Rows and Cols boxes above the matrices set the size of every matrix at once, from 1 to 10 each; the heading Matrix Input (3×3) and the note under the boxes repeat the size. Changing a box rebuilds the grids immediately: cells that still fit keep their values and new cells arrive empty. A value outside 1 to 10 is refused with "Rows must be between 1 and 10" or "Columns must be between 1 and 10" and the grids are left as they were.
When the two boxes differ an orange note, "Some operations require square matrices", appears, and the determinant, inverse, trace and LU decomposition buttons grey out; multiplication of two matrices needs the columns of A to equal the rows of B, which with one shared size means a square matrix as well. For two-matrix operations both matrices always share the size set here, so a product of a 2×3 by a 3×2 matrix cannot be entered. Why the shape matters is explained in Matrix Multiplication and Matrix Determinant.
Entering the Matrices
DemoTyping A and B, then Random, Fill All and Diagonal
Step 0 of 4
Each matrix is a card headed Matrix A or Matrix B with a grid of number boxes; type one number per cell, decimals and negatives included, and use Tab to move on. Above the grid, Random fills the matrix with whole numbers from −10 to 10 and Clear empties it. Below the grid the Value box feeds two buttons: Fill All writes the value into every cell (with an empty box, 0) and Diagonal writes it on the main diagonal with zeros elsewhere (with an empty box, 1, which gives the identity matrix). Each matrix has its own buttons, so A and B are filled separately.
An empty cell is reported at Execute time as "Matrix A has empty cells", and a cell that is not a number as "Matrix A contains invalid numbers". For scalar operations the Scalar value box sits under the matrix; it must hold a number or Execute answers "Please enter a valid scalar value". For a two-matrix operation with more than five columns, the two grids fold into accordions that open with a click on their header. The entries are indexed as in Matrix Addition, row first and column second.
Calculating and Reading the Result
DemoA determinant, an inverse, an error
Step 0 of 3
Click Execute Operation under the matrices; the button is grey until an operation is selected. The calculator first checks the input, listing every problem in a red box: empty or invalid cells, a non-square matrix for an operation that needs one, mismatched sizes ("Matrices must have the same dimensions for this operation", "For multiplication, columns of A must equal rows of B") or a missing scalar. When the input passes, the button shows "Calculating..." for a moment and the Result box fills.
The shape of the result follows the operation: a single number with its name for the determinant, trace or rank, for example "Determinant" and −2 for A=(1324); a matrix with its size for the transpose, inverse, sums and products, such as (−21.51−0.5) for the inverse; and three labelled matrices P, L and U for the LU decomposition. A singular matrix makes the inverse fail with a message in the result box. Decimals are shown rounded. Reset All clears everything and returns to the first screen. The operations behind the results start with Matrix Transpose.
The Explanation Panel, Steps and History
DemoThe panel text, the steps, the history
Step 0 of 3
The panel on the right of the input card carries the heading of the selected operation and a short text on what it computes, with a link to the section of this page that explains it; before an operation is chosen it describes the category. After a successful Execute, Calculation Steps appears under the text with the arithmetic for your numbers, for example the row-by-column products of a multiplication or the cofactors of a determinant, and a History accordion lists every computation of this visit with its time, inputs and result; Clear history empties it.
The panel changes as soon as you click another operation, and the steps disappear until the next Execute, so the text always matches the operation that is selected rather than the last one computed. Reset All clears the steps but not the history. The operations the panel describes are explained in the theory sections, grouped in Single-Matrix Operations, Two-Matrix Operations and Scalar Operations.
All six read the same cells, so one matrix can be examined from every side: for A=(1324) the transpose is (1234), the determinant −2, the inverse (−21.51−0.5), the trace 5 and the rank 2; the determinant being non-zero is what makes the inverse exist and the rank full. The lesson hub summarises these quantities in The inverse of a matrix and Rank and trace.
Matrix Transpose
The transpose of a matrix A swaps its rows and columns. If A is an m×n matrix, then AT is n×m, with each entry satisfying (AT)ij=Aji.
AijT=Aji
Key properties include (AT)T=A, (AB)T=BTAT, and (A+B)T=AT+BT. A matrix equal to its own transpose is called symmetric. The transpose is fundamental in computing dot products, defining orthogonal matrices, and constructing the normal equation for least squares problems.
The determinant is a scalar value computed from a square matrix that captures essential properties of the transformation it represents. A matrix is invertible if and only if its determinant is nonzero.
For a 2×2 matrix:
det(A)=a11a22−a12a21
For larger matrices, the determinant is computed via cofactor expansion or row reduction. Geometrically, ∣det(A)∣ measures the factor by which the matrix scales areas or volumes. Key properties: det(AB)=det(A)det(B), det(AT)=det(A), and det(cA)=cndet(A) for an n×n matrix.
The inverse of a square matrix A, denoted A−1, satisfies AA−1=A−1A=I. A matrix has an inverse only when its determinant is nonzero.
A−1=det(A)1adj(A)
The calculator finds the inverse using Gauss-Jordan elimination on the augmented matrix [A∣I]. Row operations transform the left side into I, and the right side becomes A−1. The inverse is used to solve linear systems (x=A−1b), compute matrix equations, and analyze transformations.
The trace of a square matrix is the sum of its diagonal elements:
tr(A)=i=1∑naii
The trace has several important properties. It is linear: tr(A+B)=tr(A)+tr(B) and tr(cA)=c⋅tr(A). It is cyclic: tr(ABC)=tr(BCA)=tr(CAB). The trace equals the sum of the eigenvalues of the matrix, making it useful in spectral analysis and matrix diagnostics.
The rank of a matrix is the number of linearly independent rows or columns. It equals the dimension of the column space (or row space) and is found by reducing the matrix to row echelon form and counting pivot positions.
rank(A)≤min(m,n)
A matrix with rank equal to its smaller dimension has full rank. Rank determines whether a linear systemAx=b has a unique solution, infinitely many solutions, or no solution. The rank-nullity theorem states rank(A)+nullity(A)=n where n is the number of columns.
LU decomposition factors a square matrix into a product of a lower triangular matrix L and an upper triangular matrix U, with a permutation matrix P tracking row swaps:
PA=LU
L has ones on the diagonal with elimination multipliers below. U is the result of Gaussian elimination. This factorization is efficient for solving multiple systems with the same coefficient matrix but different right-hand sides, since forward and back substitution are much cheaper than full elimination. LU decomposition is also used to compute determinants efficiently: det(A)=det(L)⋅det(U)⋅det(P).
Matrix addition sums corresponding elements of two matrices with identical dimensions. If A and B are both m×n:
(A+B)ij=aij+bij
Addition is commutative (A+B=B+A) and associative ((A+B)+C=A+(B+C)). The zero matrix acts as the additive identity. Subtraction works identically, replacing each sum with a difference: (A−B)ij=aij−bij. Both operations preserve matrix dimensions.
Matrix subtraction computes the element-wise difference between two matrices of the same dimensions:
(A−B)ij=aij−bij
Subtraction is equivalent to adding the negation: A−B=A+(−B). Unlike addition, subtraction is not commutative: A−B=B−A in general. The result has the same dimensions as both input matrices. Subtraction is used in computing residuals, error matrices, and the commutator operation [A,B]=AB−BA.
Matrix multiplication combines an m×n matrix A with an n×p matrix B to produce an m×p result. The number of columns in A must equal the number of rows in B. Try which sizes fit.
(AB)ij=k=1∑naikbkj
Each entry is the dot product of a row from A with a column from B. Multiplication is associative and distributive over addition, but not commutative: AB=BA in general. Matrix multiplication models composition of linear transformations and is the core operation in systems of equations, computer graphics, and machine learning.
The Hadamard product, denoted A⊙B, multiplies corresponding elements of two matrices with the same dimensions:
(A⊙B)ij=aij⋅bij
Unlike standard matrix multiplication, the Hadamard product is commutative (A⊙B=B⊙A) and preserves dimensions. It appears in signal processing, neural network computations (gradient masking, attention mechanisms), and statistics. The Schur product theorem states that if A and B are both positive semidefinite, then A⊙B is also positive semidefinite.
The Kronecker product A⊗B replaces each element aij of A with the block aij⋅B. If A is m×n and B is p×q, the result is mp×nq.
The Kronecker product is bilinear and associative but not commutative. Key properties include (A⊗B)(C⊗D)=(AC)⊗(BD) when dimensions allow, and det(A⊗B)=det(A)q⋅det(B)m for square matrices. It is used in quantum computing (tensor product of state spaces), control theory, and signal processing.
The commutator of two square matrices is defined as:
[A,B]=AB−BA
When [A,B]=0 (the zero matrix), A and B commute, meaning their multiplication order does not matter. The commutator is antisymmetric: [A,B]=−[B,A] and satisfies the Jacobi identity: [A,[B,C]]+[B,[C,A]]+[C,[A,B]]=0. The commutator is fundamental in Lie algebra, quantum mechanics (where it relates to the uncertainty principle), and differential geometry.
The anti-commutator of two square matrices is defined as:
{A,B}=AB+BA
It is the symmetric counterpart of the commutator. The anti-commutator is always symmetric: {A,B}={B,A}. In quantum mechanics, anti-commutation relations define fermionic operators (particles obeying the Pauli exclusion principle), while commutation relations define bosonic operators. The anti-commutator also appears in Clifford algebras and Jordan algebras.
The Scalar Operations category combines one matrix with one number c, typed in the Scalar value box: Scalar Multiplication, Scalar Addition, Scalar Subtraction and Matrix Power, where the scalar is the exponent. Multiplication, addition and subtraction work on any shape; the power needs a square matrix and a non-negative whole exponent.
For A=(1324) and c=2: 2A=(2648), A+2=(3546) and A2=(7151022). Only scalar multiplication is one of the standard vector-space operations; the other three are conveniences. See Scalar multiplication and Matrix powers.
Scalar Multiplication
Scalar multiplication multiplies every element of a matrix by a single number c:
(cA)ij=c⋅aij
This scales the entire matrix uniformly. For the determinant, det(cA)=cndet(A) where n is the matrix size. Scalar multiplication is commutative (cA=Ac), associative (c(dA)=(cd)A), and distributes over matrix addition (c(A+B)=cA+cB). Geometrically, it scales the linear transformation represented by the matrix.
Scalar addition adds a constant c to every element of a matrix:
(A+c)ij=aij+c
Scalar subtraction works the same way with a minus sign. Note that this is different from adding cI (scalar times identity), which only affects diagonal elements. Scalar addition shifts all entries by the same amount and is used in data normalization, bias adjustments, and preprocessing steps in numerical computation.
Scalar addition adds the same number c to every entry: (A+c)ij=aij+c. For A=(1324) and c=1 the result is (2435). The operation keeps the shape of A and shifts every entry by the same amount, which is what a spreadsheet does when a constant is added to a whole block of cells.
It is not the same as A+cI, which adds c to the diagonal only; the calculator's Scalar Addition changes all four entries, so the determinant and the eigenvalues do not follow a simple rule. The common mistake is to mix the two up when a textbook writes A+c as shorthand for A+cI. The arithmetic it sits next to is in Matrix arithmetic at a glance and Linear combinations of matrices.
Scalar Subtraction
Scalar subtraction takes the same number c from every entry: (A−c)ij=aij−c. For A=(1324) and c=1 the result is (0213); it is scalar addition with −c, so the two operations undo each other.
As with scalar addition, this is an entry-wise shift and not A−cI, which only touches the diagonal; the latter is the matrix whose determinant gives the characteristic polynomial. The common mistake is to expect the trace to drop by c when it drops by nc for an n×n matrix, since every diagonal entry moves. See Matrix arithmetic at a glance and Scalar multiplication for the operations that do follow the usual rules.
Matrix Power
Matrix power raises a square matrix to a non-negative integer exponent through repeated multiplication:
An=n timesA⋅A⋯A
By convention, A0=I (the identity matrix). The calculator uses exponentiation by squaring for efficiency, reducing the cost from O(n) multiplications to O(logn). Matrix powers appear in Markov chains (transition probabilities over n steps), solving linear recurrences, graph theory (counting paths of length n), and computing the matrix exponential.
This matrix calculator covers single-matrix analysis, two-matrix operations, and scalar operations. For solving systems of linear equations (Gaussian elimination, Gauss-Jordan, Cramer's Rule, and inverse method), use the dedicated Linear Systems Calculator.
Related linear algebra topics include eigenvalues and eigenvectors, singular value decomposition (SVD), QR decomposition, vector operations, and matrix norms. These tools and concepts build on the foundational operations available in this calculator.