Matrix Calculator

Perform matrix addition, subtraction, multiplication, determinants, inverses, eigenvalues, decompositions, and advanced linear algebra operations with step-by-step solutions.

Matrix A

Rows

4

Cols

4

Matrix B

Rows

4

Cols

4

Operations

Binary operations (use both A and B)

Operations on Matrix A

Operations on Matrix B

Advanced linear algebra (Matrix A)

Linear system solver

Linear-system solver treats A as the coefficient matrix and B as the right-hand side (one or more constant columns). For a single equation system use a single-column B.

Live properties dashboard

Matrix A

4 × 4

Rank4
Trace16
Determinant-4
Frobenius15.6205
‖A‖∞ (max |aᵢⱼ|)7
Nullity0
SquareSymmetricDiagonalUpper △Lower △IdentityOrthogonalPositive-definiteSingular

Matrix B

4 × 4

Rank4
Trace6
Determinant-42
Frobenius8.9443
‖A‖∞ (max |aᵢⱼ|)5
Nullity0
SquareSymmetricDiagonalUpper △Lower △IdentityOrthogonalPositive-definiteSingular

What is a Matrix Calculator?

A matrix calculator performs every operation in introductory and advanced linear algebra on rectangular grids of numbers. This tool handles two matrices up to 10 × 10 and covers the full operations spectrum: addition (A + B), subtraction (A − B), multiplication in both directions (A × B and B × A), scalar multiplication, transpose (Aᵀ, Bᵀ), integer powers (Aⁿ, Bⁿ), determinant det(A), inverse A⁻¹ via Gauss-Jordan, rank, trace, Frobenius and max norms, eigenvalues via the shifted QR algorithm, LU decomposition with partial pivoting, Householder QR, Cholesky factorisation, and full linear-system solving Ax = b with unique / infinite / no-solution detection.

Every operation comes with a one-line equation caption, a verification panel where applicable, a live properties dashboard (rank, trace, determinant, norms, symmetry, orthogonality, positive-definiteness, triangularity), and heatmap visualisations for both operands. Pair it with the scientific calculator, distance calculator (for vector norms), or the slope calculator for 2D linear analysis.

How matrix operations are computed

Addition & subtraction are component-wise

(A + B)ᵢⱼ = Aᵢⱼ + Bᵢⱼ. Both matrices must have identical dimensions. Subtraction is the same operation with B replaced by −B.

Multiplication is row-by-column dot product

Multiply an m×n matrix by an n×p matrix. Entry (i, j) of the product is Σₖ AᵢₖBₖⱼ. The inner dimensions must match, and AB ≠ BA in general.

Transpose flips rows ↔ columns

(Aᵀ)ᵢⱼ = Aⱼᵢ. It satisfies (AB)ᵀ = Bᵀ Aᵀ and (Aᵀ)ᵀ = A. Symmetric matrices are exactly the ones equal to their own transpose.

Determinant via LU decomposition

Factor A = PLU. Then det(A) = sign(P) × ∏ Uᵢᵢ. This is O(n³) and the standard numerical method. A zero diagonal entry in U means A is singular.

Inverse via Gauss-Jordan on [A | I]

Reduce [A | I] to [I | A⁻¹]. Works only when A is square and non-singular. Numerically stable with partial pivoting.

Eigenvalues via shifted QR

Repeatedly apply Q, R = QR(H − μI) and form H′ = RQ + μI. With Wilkinson shifts, the subdiagonals tend to zero and eigenvalues appear on the diagonal (or in 2×2 blocks for complex pairs).

6 ways to use the Matrix Calculator

1

Solve linear systems Ax = b

Put coefficients in A and constants in B (a single column), then click Solve A·x = B. The result panel shows the unique solution, an infinite family, or proves no solution exists.

2

Verify a textbook inverse

Compute A⁻¹, then A × A⁻¹ — it should return the identity matrix within rounding tolerance. Use the Copy → B action to set up the verification multiplication in one click.

3

Find principal axes via eigenvalues

Eigenvalues of a covariance or stiffness matrix reveal principal directions, vibration modes, and PCA components. Spectral radius indicates stability of iterative schemes.

4

Test for positive-definiteness

Try a Cholesky factorisation. If it succeeds (no negative square-root), A is symmetric positive-definite — exactly the condition for unique optimisation and Gaussian likelihoods.

5

Factor for repeated solves

LU is computed once in O(n³) and then every subsequent Ax = b costs only O(n²). Useful when the same matrix appears with many right-hand sides — finite-element loads, time-stepped simulations, batch inversions.

6

Homework, exams, competition prep

Step-equation captions and verification matrices let you cross-check every step of a manual solution. Heatmaps make sparsity, symmetry, and dominant-diagonal structure obvious at a glance.

Best practices for accurate matrix work

Confirm dimensions before multiplying. An m×n times n×p product needs the inner dimensions to match. A common error is multiplying A × B when only B × A is defined; this calculator flags the mismatch with an exact error message.

Prefer LU over computing A⁻¹ for solves. Forming A⁻¹ then multiplying by b is slower and numerically worse than a single Gaussian elimination on [A | b]. Use the linear-system solver for one-off solves and LU for repeated solves with different right-hand sides.

Use the determinant as a quick singularity check. If det(A) is exactly 0 (or within tolerance), the inverse does not exist and the linear system has either no solution or infinitely many — exactly the cases the solver detects.

Watch for ill-conditioning. When det(A) is tiny but non-zero, small input changes can swing the result hugely. The Frobenius norm of A times the Frobenius norm of A⁻¹ approximates the condition number — a value over 10⁶ is a red flag.

Symmetric + positive entries does NOT mean positive-definite. The Cholesky tool is the definitive test: it succeeds exactly when A is symmetric positive-definite. The dashboard chip toggles automatically as you edit.

Identity check finds typos fast. If you intended an identity matrix, the dashboard's Identity chip will glow only when every off-diagonal entry is zero and every diagonal entry is one. Useful when sanity-checking products like A × A⁻¹.

Why matrices matter

Matrices are the universal language of linear systems. Every 3D rotation in computer graphics, every fully-connected layer in a neural network, every PageRank computation behind a search engine, every Kalman filter onboard a spacecraft, and every finite-element simulation that designs a bridge ultimately reduces to a small set of matrix operations: multiplication, inversion, decomposition, and eigendecomposition.

Fluency with the determinant, inverse, rank, and eigenvalues lets you switch between coordinate systems, separate signal from noise, recognise when a model is degenerate, and predict the long-term behaviour of dynamical processes. The properties dashboard above turns this fluency into a real-time feedback loop while you edit.

Tricky cases worth knowing

Singular matrices

A square matrix with det = 0 has no inverse. The linear-system solver returns either 'no solution' (inconsistent right-hand side) or 'infinite solutions' (free variables) — never a unique answer.

Complex eigenvalues

Even real matrices can have complex eigenvalues; they always come in conjugate pairs. The calculator displays them as a ± bi and plots both on the complex plane.

Non-diagonalisable matrices

Some matrices have fewer linearly independent eigenvectors than eigenvalues (defective matrices). Eigenvalues are still well-defined and useful, but Jordan-form analysis is required for a full picture.

Floating-point noise

Round-off can leave tiny non-zero entries where exact zeros should appear (e.g. below the diagonal in U after LU). The display rounds values smaller than 10⁻¹² to 0 to keep results readable.

Cholesky failure ≠ bad matrix

If Cholesky fails, the matrix may still be invertible — it just isn't positive-definite. Use LU or QR for non-SPD matrices instead.

Core formulas library

Addition / subtraction

(A ± B)ᵢⱼ = Aᵢⱼ ± Bᵢⱼ

Multiplication

(A × B)ᵢⱼ = Σₖ Aᵢₖ Bₖⱼ

Transpose

(Aᵀ)ᵢⱼ = Aⱼᵢ (AB)ᵀ = BᵀAᵀ

Power

Aⁿ = A · A · … · A (n factors)

Determinant (Leibniz)

det(A) = Σ_{σ ∈ Sₙ} sgn(σ) · ∏ᵢ Aᵢ,σ(i)

Inverse

A⁻¹ = adj(A) / det(A), A A⁻¹ = I

Eigenvalue equation

A v = λ v, det(A − λI) = 0

Trace

tr(A) = Σᵢ Aᵢᵢ = Σ λᵢ

Rank

rank(A) = number of pivots in RREF(A)

Frobenius norm

‖A‖_F = √( Σᵢⱼ Aᵢⱼ² )

LU decomposition

P A = L U (L unit lower, U upper)

QR decomposition

A = Q R (Qᵀ Q = I, R upper)

Cholesky

A = L Lᵀ (A symmetric pos-def)

SVD

A = U Σ Vᵀ (Σ diag of singular values)

Common mistakes to avoid

  • Assuming AB = BA — matrix multiplication is not commutative; A × B and B × A often differ and may not even have the same dimensions.
  • Confusing A⁻¹ with Aᵀ — they coincide only for orthogonal matrices.
  • Dividing by a matrix — there is no matrix division; instead multiply by the inverse on the correct side.
  • Treating det(A + B) as det(A) + det(B) — the determinant is multiplicative, not additive: det(AB) = det(A) det(B).
  • Using row reduction to find an inverse without tracking the identity side — you'll get rref(A) but not A⁻¹.
  • Forgetting that powers require a square matrix — Aⁿ is only defined when A is n×n.
  • Reading 'trace' as 'determinant' — trace is the sum of diagonal entries (and the sum of eigenvalues); determinant is the product of eigenvalues.

Special matrices reference

TypeDefining propertyExample (3×3)
IdentityAᵢⱼ = δᵢⱼ (Kronecker)[[1,0,0],[0,1,0],[0,0,1]]
DiagonalAᵢⱼ = 0 for i ≠ j[[3,0,0],[0,−1,0],[0,0,7]]
SymmetricAᵢⱼ = Aⱼᵢ[[2,1,4],[1,5,0],[4,0,6]]
OrthogonalAᵀA = I (rotation/reflection)[[cosθ,−sinθ,0],[sinθ,cosθ,0],[0,0,1]]
Upper triangularAᵢⱼ = 0 for i > j[[2,5,7],[0,3,1],[0,0,4]]
Lower triangularAᵢⱼ = 0 for i < j[[2,0,0],[5,3,0],[7,1,4]]
PermutationSingle 1 in each row and column[[0,1,0],[0,0,1],[1,0,0]]
Skew-symmetricAᵀ = −A (diagonal = 0)[[0,2,−1],[−2,0,3],[1,−3,0]]

Applications across science and engineering

Machine learning

Every neural-network layer is a matrix multiply (W · x + b). Convolutions, attention, and embeddings are all dense or sparse matrix operations. SVD powers PCA, recommender systems, and noise reduction.

Computer graphics

3D rotations, translations, projections, and skinning are 4×4 matrix multiplications. Inverse and transpose of the model matrix give the normal matrix used for correct lighting after non-uniform scaling.

Engineering & physics

Finite-element method assembles a global stiffness matrix; structural analysis reduces to K u = f. Eigenvalues give vibration modes; the spectral radius decides stability of explicit time-steppers.

Statistics & economics

Linear regression solves the normal equations Xᵀ X β = Xᵀ y. Covariance matrices, principal components, and Leontief input-output models all live in matrix algebra.

Cryptography & coding

Hill ciphers, lattice-based cryptosystems, and error-correcting codes (Hamming, Reed-Solomon) use matrices over finite fields. The determinant must be coprime to the modulus for invertibility.

Robotics & control

Forward kinematics chains 4×4 homogeneous transforms; inverse kinematics solves them. The Jacobian links joint velocities to end-effector velocities; its rank tells you when you're at a singularity.

Methodology and references

Algorithms follow the standard references for numerical linear algebra: Matrix Computations by Golub & Van Loan (4th ed.), Numerical Linear Algebra by Trefethen & Bau, and Linear Algebra and Its Applications by Gilbert Strang. Determinant uses LU with partial pivoting, inverse uses Gauss-Jordan, QR uses Householder reflections, and eigenvalues use the shifted QR algorithm with Wilkinson shifts. Where exact zeros are expected (below the diagonal of R after Householder QR, off the diagonal of a diagonal matrix), values smaller than 10⁻¹² are rounded to zero for display.

Frequently asked questions

A matrix is a rectangular grid of numbers arranged in rows and columns. An m×n matrix has m rows and n columns, with the entry in row i and column j written aᵢⱼ. Matrices represent linear transformations, systems of equations, datasets, and much more.

Multiply an m×n matrix by an n×p matrix to get an m×p matrix. Entry (i, j) of the product is the dot product of row i of the first matrix with column j of the second: (A×B)ᵢⱼ = Σₖ AᵢₖBₖⱼ. The inner dimensions must match, and AB ≠ BA in general.

The determinant of a square matrix is a scalar that measures how the linear transformation scales volume. det = 0 means the matrix is singular and has no inverse.

A⁻¹ is the unique matrix where A × A⁻¹ = I. Only square matrices with non-zero determinant are invertible. Computed via Gauss-Jordan elimination on [A | I].

Rank is the number of linearly independent rows (or columns), equal to the number of non-zero rows after Gaussian elimination. A square matrix has full rank exactly when it is invertible.

An eigenvalue λ of A is a scalar such that Av = λv for some non-zero vector v. They are roots of the characteristic polynomial det(A − λI) = 0 and reveal stability, principal axes, and natural frequencies.

Eigenvectors are the non-zero vectors v that satisfy Av = λv — the special directions a matrix only stretches without rotating. They form a basis when A is diagonalisable.

LU factors A into a lower-triangular L and upper-triangular U so that A = LU (or PA = LU with partial pivoting). It enables fast Ax = b solves and constant-time determinants.

Singular Value Decomposition factors any matrix as A = UΣVᵀ with U, V orthogonal and Σ diagonal of singular values. It powers PCA, image compression, and the pseudo-inverse.

Computer graphics, machine learning, search engines (PageRank), economics, quantum mechanics, robotics, finite-element analysis, cryptography, and statistics — virtually every quantitative field.