Matrix Calculator
Choose an operation, set size, enter values and calculate instantly
What Is a Matrix?
Understanding matrices, key operations, and why they are fundamental to science and engineering
A matrix is a rectangular array of numbers arranged in rows and columns. An m×n matrix has m rows and n columns. Matrices are the backbone of linear algebra — used to represent linear transformations, solve systems of equations, describe graphs, encode images, and power machine learning algorithms.
A matrix where m = n is called a square matrix — only square matrices have determinants, inverses, and traces. A 1×n matrix is a row vector; an n×1 matrix is a column vector. The identity matrix has 1s on the diagonal and 0s elsewhere — it's the matrix equivalent of the number 1.
This calculator supports 12 matrix operations on square matrices up to 5×5: addition, subtraction, multiplication, scalar multiply, transpose, determinant, inverse, trace, rank, matrix power, Hadamard product, and dot product.
Operation Reference
All 12 operations with formulas, dimension rules and use cases
| Operation | Symbol | Dimension Rule | Result Type | Use Case |
|---|---|---|---|---|
| Addition | A + B | Same size m×n | m×n matrix | Combining linear transformations |
| Subtraction | A − B | Same size m×n | m×n matrix | Difference of transformations |
| Multiplication | A × B | A is m×n, B is n×p | m×p matrix | Composing transformations |
| Scalar Multiply | k × A | Any A, scalar k | Same size as A | Uniform scaling of all elements |
| Transpose | Aᵀ | Any m×n | n×m matrix | Symmetry, dot products, covariance |
| Determinant | det(A) | Square n×n only | Scalar | Invertibility, volume scaling |
| Inverse | A⁻¹ | Square, det ≠ 0 | n×n matrix | Solving linear systems Ax = b |
| Trace | tr(A) | Square n×n only | Scalar | Sum of diagonal = sum of eigenvalues |
| Rank | rank(A) | Any m×n | Integer | Dimension of column/row space |
| Matrix Power | Aⁿ | Square, n ≥ 0 | n×n matrix | Markov chains, graph walks |
| Hadamard Product | A ∘ B | Same size m×n | m×n matrix | Element-wise weighting, neural nets |
| Dot Product | A · B | Row 1 of A · Col 1 of B | Scalar | Angle between vectors, projections |
How to Use the Matrix Calculator
Step-by-step guide for students and professionals
- 1
Choose Your Operation
Select from the 12 operation tiles. Operations that use only Matrix A — Determinant, Inverse, Transpose, Trace, Rank, Scalar, Power — automatically hide Matrix B. Two-matrix operations show both grids side by side.
- 2
Set the Matrix Size
Choose 2×2, 3×3, 4×4 or 5×5 using the size chips. The grids rebuild instantly. All cells reset to blank — previous values are cleared when you change size.
- 3
Enter Values or Use Presets
Click each cell and type a number (decimals and negatives supported). Press Tab to move right. Hit the Random button for random integers −9 to 9. Use sidebar presets to fill Identity, Zeros, Ones, or Diagonal matrices in one click.
- 4
Calculate and Review
Press Calculate Matrix. Matrix results display as a formatted green grid. Scalar results (determinant, trace, rank) show as a single large number. The operation name always appears in the result header.
- 5
Expand Step-by-Step Solution
Click the Step-by-Step panel to see the full working. Multiplication shows each dot product. Determinants show cofactor expansion. Inverses show the Gauss-Jordan method. Share or copy results using the buttons below the result.
Matrices in the Real World
How matrix operations power technology, science and everyday life
Neural Networks Are Matrix Multiplications
Every layer in a deep learning model is a matrix multiply: output = activation(W × input + b). GPUs are optimised to do billions of these per second. All of modern AI is linear algebra — matrix multiplication is the most important computation in the world today.
3D Graphics Use 4×4 Matrices
Every rotation, translation and scaling in games and movies is a 4×4 transformation matrix. The GPU multiplies millions of vertex vectors by these matrices per frame to render the image you see. OpenGL and DirectX are fundamentally matrix multiplication engines.
Google PageRank Is an Eigenvector
Google's original ranking algorithm finds the dominant eigenvector of the web's link matrix — a trillion-node graph. The vector scores every page by "importance". Solving this required new iterative methods (power iteration) to handle a matrix too large to store explicitly.
Fourier Transform Is Matrix Multiplication
The DFT is F = W × x, where W is the complex DFT matrix. The FFT algorithm factorises W into sparse matrices for O(n log n) efficiency. Used in audio (MP3), images (JPEG), communications (5G), and MRI reconstruction.
Kalman Filters in GPS and Aerospace
The Kalman filter updates state estimates via recursive matrix operations. Used in GPS, self-driving cars, spacecraft navigation, and missile guidance systems. It optimally combines noisy sensor measurements using covariance matrices to track moving objects in real time.
Quantum Computing Runs on Matrices
In quantum mechanics, every quantum gate is a unitary matrix, and the state of n qubits is a 2ⁿ-dimensional complex vector. Quantum computation is literally matrix-vector multiplication in exponentially large spaces — harnessing interference to solve problems faster than classical computers.
PCA Finds Eigenvectors of Covariance Matrices
Principal Component Analysis computes the covariance matrix of data, then finds its eigenvectors. These principal components are the "natural axes" of the data — directions of maximum variance. Used in face recognition, genomics, finance, and dimensionality reduction of billions of features.
Medical Imaging Solves Matrix Equations
CT scans reconstruct 3D images by solving a huge system of linear equations — essentially inverting a massive matrix that maps X-ray measurements to tissue density. MRI uses the Fourier transform (also a matrix operation) to convert k-space frequency data into spatial images.
Frequently Asked Questions
Common questions about matrix operations and linear algebra