🔢 Select Operation

Matrix A:
×
rows × cols
Result

Matrix Formulas & Rules

Matrix Addition / Subtraction

Matrices must have the same dimensions. Add/subtract element by element.

[A+B]ᵢⱼ = Aᵢⱼ + Bᵢⱼ

[1 2] + [5 6] = [6 8]
[3 4] [7 8] [10 12]

Matrix Multiplication

A must be m×n, B must be n×p. Result is m×p. Row × Column dot product.

[AB]ᵢⱼ = Σ Aᵢₖ × Bₖⱼ

Note: AB ≠ BA in general (not commutative!)

[1 2] × [5 6] = [1×5+2×7 1×6+2×8] = [19 22]
[3 4] [7 8] [3×5+4×7 3×6+4×8] [43 50]

Transpose

[Aᵀ]ᵢⱼ = Aⱼᵢ (flip rows and columns)

[1 2 3]ᵀ = [1 4]
[4 5 6] [2 5]
[3 6]

Properties: (AB)ᵀ = BᵀAᵀ, (Aᵀ)ᵀ = A

Determinant

2×2: det(A) = ad − bc
[a b]
[c d]

3×3: Cofactor expansion along row 1:
det(A) = a₁₁·M₁₁ − a₁₂·M₁₂ + a₁₃·M₁₃
where Mᵢⱼ = minor (det of submatrix)

Inverse Matrix

A⁻¹ exists only if det(A) ≠ 0

2×2: A⁻¹ = (1/det) × [ d -b]
[-c a]

nxn: A⁻¹ = adj(A) / det(A)

Verify: A × A⁻¹ = I (identity matrix)

Trace & Rank

Trace = sum of diagonal elements = Σ Aᵢᵢ
tr([1 2]) = 1 + 4 = 5
([3 4])

Rank = number of linearly independent rows/columns
Rank ≤ min(rows, cols)

Special Matrices

Identity (I): diagonal = 1, rest = 0
Zero: all elements = 0
Symmetric: A = Aᵀ
Diagonal: non-zero only on main diagonal
Singular: det = 0 (no inverse exists)
Orthogonal: AᵀA = I (Aᵀ = A⁻¹)

Frequently Asked Questions

A matrix is a rectangular array of numbers arranged in rows and columns. A 3×2 matrix has 3 rows and 2 columns, containing 6 elements. Matrices are the primary data structure of linear algebra and appear in physics, computer graphics, machine learning, statistics, cryptography, and engineering. The notation [m×n] describes dimensions - m rows, n columns. A matrix with equal rows and columns is a 'square matrix.'
Matrix multiplication A×B requires the number of columns in A to equal the number of rows in B. If A is m×n and B is n×p, the result is an m×p matrix. The shared dimension n must match - these are called the 'inner dimensions.' Examples: 3×4 can multiply 4×2 (result 3×2). 2×3 cannot multiply 4×3. Critical property: matrix multiplication is NOT commutative. A×B ≠ B×A in general, even when both products are defined (as with square matrices).
The determinant is a single scalar value computed from a square matrix that encodes key properties. If det(A) ≠ 0: the matrix is invertible. If det(A) = 0: the matrix is singular - no inverse exists. Geometrically, |det(A)| is the scale factor of the linear transformation - a 2×2 matrix with det = 5 scales areas by 5×; a negative determinant indicates a reflection. For 2×2 [[a,b],[c,d]]: det = ad − bc.
The inverse A⁻¹ satisfies A × A⁻¹ = A⁻¹ × A = I (identity matrix). It exists only when det(A) ≠ 0. For 2×2 matrix [[a,b],[c,d]]: A⁻¹ = (1÷det) × [[d,−b],[−c,a]]. The inverse is used to 'undo' a matrix transformation and to solve systems of linear equations: if Ax = b, then x = A⁻¹b. For 3×3 and larger, the inverse is computed via the adjugate matrix divided by the determinant - the calculator shows all steps.
The transpose Aᵀ is formed by flipping a matrix over its main diagonal - rows become columns and columns become rows. A 3×2 matrix becomes 2×3. Properties: (AB)ᵀ = BᵀAᵀ (note reversed order). (Aᵀ)ᵀ = A. For symmetric matrices, A = Aᵀ. Transposes are used extensively in linear algebra proofs and in machine learning (gradient computations, covariance matrices, etc.).
The trace is the sum of the diagonal elements of a square matrix. For matrix A: tr(A) = A₁₁ + A₂₂ + ... + Aₙₙ. Properties: tr(A+B) = tr(A) + tr(B). tr(AB) = tr(BA) (even though AB ≠ BA in general). tr(A) equals the sum of eigenvalues of A. The trace is used in physics (stress tensors), statistics (variance of multivariate distributions), and machine learning (Frobenius norm involves trace).
The identity matrix I (or Iₙ for n×n) has 1s on the main diagonal and 0s everywhere else. It is the matrix equivalent of the number 1: A × I = I × A = A for any compatible matrix A. The 2×2 identity is [[1,0],[0,1]], the 3×3 is [[1,0,0],[0,1,0],[0,0,1]]. The inverse of any invertible matrix satisfies A × A⁻¹ = I. Identity matrices are used as the starting point in Gaussian elimination and as the result of eigendecomposition checks.
A singular (degenerate) matrix has det = 0, meaning its rows (or columns) are linearly dependent - one row can be expressed as a combination of the others. Singular matrices have no inverse. In a system of linear equations Ax = b, a singular A means no unique solution exists - either no solution (inconsistent system) or infinitely many solutions (underdetermined system). Geometrically, a singular transformation collapses the space into a lower dimension - a 2D area collapses to a line, a 3D volume collapses to a plane.

Matrix Calculator - Operations, Rules and What Each One Means

Matrices are the core data structure of linear algebra - and linear algebra is the mathematical foundation of computer graphics, machine learning, physics simulations, cryptography, and data science. Understanding matrix operations and the rules governing when they apply is essential for anyone working in these fields or studying mathematics beyond the basics.

The most common mistake: Assuming matrix multiplication is commutative. It is not. In general, A×B ≠ B×A. Even when both products are defined (square matrices), they typically produce different results. This is one of the first things students get wrong and one of the most important properties to remember.

Matrix Operations - When Each One Applies

Operations Requiring Matching Dimensions

  • Addition (A + B): Both matrices must be exactly the same size (m×n + m×n). Add element by element.
  • Subtraction (A − B): Same rule as addition. Subtract element by element.
  • Scalar multiplication (kA): Any matrix. Multiply every element by the scalar k.
  • Hadamard product (A⊙B): Same size required. Element-wise multiplication (not standard matrix multiplication).

Operations with Dimension Rules

  • Multiplication (A×B): Columns of A must equal rows of B. A is m×n, B is n×p result is m×p.
  • Determinant: Square matrices only (2×2, 3×3, 4×4...).
  • Inverse: Square matrix with det ≠ 0 only.
  • Transpose (Aᵀ): Any matrix. m×n n×m.
  • Trace: Square matrices only. Sum of diagonal elements.

The Determinant - What It Represents Geometrically

The determinant of a 2×2 matrix represents the area of the parallelogram formed by its row (or column) vectors. For a 3×3 matrix, it's the volume of the parallelepiped. More generally, the absolute value of the determinant is the scale factor of the linear transformation the matrix represents.

For a 2×2 matrix [[a, b], [c, d]]: det = ad − bc. Example: [[3, 1], [2, 4]] det = 3×4 − 1×2 = 12 − 2 = 10. This means the linear transformation represented by this matrix scales areas by a factor of 10.

A determinant of 0 means the transformation collapses the space into a lower dimension - a plane becomes a line, a 3D object becomes flat. This is why singular matrices (det = 0) have no inverse: there's no way to "undo" a transformation that destroys a dimension.

Finding the Inverse - Two Methods

For a 2×2 matrix [[a, b], [c, d]], the inverse is: (1 ÷ det) × [[d, −b], [−c, a]]. The steps are: (1) Swap the diagonal elements (a and d). (2) Negate the off-diagonal elements (b becomes −b, c becomes −c). (3) Divide every element by the determinant. Example: Matrix [[2, 1], [5, 3]], det = 2×3 − 1×5 = 1. Inverse = (1÷1) × [[3, −1], [−5, 2]] = [[3, −1], [−5, 2]]. Verify: [[2,1],[5,3]] × [[3,−1],[−5,2]] = [[1,0],[0,1]]

For 3×3 and larger matrices, the formula becomes much more complex (cofactor matrix, adjugate, and division by determinant). The calculator handles all of this automatically with step-by-step output.

Matrix Applications - Why This Matters Beyond the Classroom

  • Computer graphics: Every rotation, scaling, and translation of objects in 3D/2D space is a matrix multiplication. Rendering engines chain multiple transformations by multiplying their matrices together.
  • Machine learning: Neural networks are fundamentally chains of matrix multiplications and non-linear activations. Training involves computing gradients through these matrices (backpropagation).
  • Solving linear equations: A system of n equations in n unknowns is written as Ax = b and solved by x = A⁻¹b (if A is invertible) or via Gaussian elimination.
  • Cryptography: Hill cipher uses matrix multiplication over modular arithmetic. Many encryption algorithms rely on linear algebra properties.
  • Economics / Operations Research: Input-output models (Leontief matrix), Markov chains, and portfolio optimisation all use matrix operations.

How this calculator works, and where the numbers come from

The Matrix Calculator applies the standard formula for this calculation to the values you enter and updates the result as you type. The calculation itself happens in your browser, and the page explains the method so you can check any result by hand.

Please note: Results are provided for general information and are calculated from the values you enter.

Sources and further reading

Last reviewed: by the CalcQube Editorial Team. See our editorial policy for how we build and check calculators, or report an error.