Matrix Calculator
Perform matrix operations including addition, multiplication, determinant, inverse, and transpose. Calculate with 2x2, 3x3, and larger matrices.
Matrix A
Matrix B
Result: A × B
Matrix Operation Rules
- • Addition/Subtraction: Matrices must have same dimensions
- • Multiplication: Columns of A must equal rows of B
- • Determinant: Only for square matrices
- • Inverse: Only exists if determinant ≠ 0
- • Transpose: Rows become columns, columns become rows
About This Calculator
Matrices are fundamental structures in linear algebra used to represent and solve systems of linear equations, perform transformations, and encode data. This calculator performs essential matrix operations including addition, multiplication, determinants, inverses, and transposes.
What is a Matrix? 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 denoted with capital letters (A, B, C) and elements are accessed by row and column indices.
Matrix Applications:
- Computer Graphics: Transformations (rotation, scaling, translation)
- Data Science: Data representation and manipulation
- Engineering: Solving systems of equations
- Physics: Quantum mechanics, relativity
- Economics: Input-output models, optimization
Basic Operations:
- Addition/Subtraction: Element-wise, requires same dimensions
- Multiplication: Row-by-column, dimensions must be compatible
- Scalar Multiplication: Multiply every element by a constant
- Transpose: Flip rows and columns
- Determinant: Single number summarizing matrix properties
- Inverse: Matrix that "undoes" multiplication
This calculator handles 2×2 and 3×3 matrices with step-by-step results. For systems of equations, see our Equation Solver.
How to Use the Matrix Calculator
- 1Select the operation you want to perform.
- 2Choose the size of Matrix A (2×2 or 3×3).
- 3Enter the values for Matrix A.
- 4If needed, choose the size and enter values for Matrix B.
- 5For scalar multiplication, enter the scalar value.
- 6View the result displayed below.
- 7Check that matrix dimensions are compatible for your operation.
- 8For inverse, verify the determinant is non-zero.
- 9Use results for further calculations as needed.
- 10Try different values to understand matrix behavior.
Matrix Addition and Subtraction
Adding and subtracting matrices is element-wise.
Requirements
Both matrices must have identical dimensions (same number of rows and columns).
Formula
If A and B are both m×n matrices: (A + B)ᵢⱼ = Aᵢⱼ + Bᵢⱼ (A - B)ᵢⱼ = Aᵢⱼ - Bᵢⱼ
Example
A = [1 2] B = [5 6] [3 4] [7 8]
A + B = [1+5 2+6] = [6 8] [3+7 4+8] [10 12]
A - B = [1-5 2-6] = [-4 -4] [3-7 4-8] [-4 -4]
Properties
- Commutative: A + B = B + A
- Associative: (A + B) + C = A + (B + C)
- Identity: A + 0 = A (0 is zero matrix)
- Inverse: A + (-A) = 0
Matrix Multiplication
Matrix multiplication combines rows of the first matrix with columns of the second.
Requirements
If A is m×n and B is p×q:
- n must equal p (columns of A = rows of B)
- Result is m×q
Formula
(AB)ᵢⱼ = Σₖ Aᵢₖ × Bₖⱼ
Each element is the dot product of row i from A and column j from B.
Example (2×2)
A = [1 2] B = [5 6] [3 4] [7 8]
AB = [1×5+2×7 1×6+2×8] = [19 22] [3×5+4×7 3×6+4×8] [43 50]
Important Properties
- NOT Commutative: AB ≠ BA in general
- Associative: (AB)C = A(BC)
- Distributive: A(B+C) = AB + AC
- Identity: AI = IA = A (I is identity matrix)
Identity Matrix
I = [1 0] or I = [1 0 0] [0 1] [0 1 0] [0 0 1]
AI = IA = A for any compatible matrix A.
Determinants
The determinant is a scalar value that encodes important properties of a square matrix.
2×2 Determinant
For A = [a b] [c d]
det(A) = ad - bc
3×3 Determinant
For A = [a b c] [d e f] [g h i]
det(A) = a(ei-fh) - b(di-fg) + c(dh-eg)
(Expansion along first row)
What Determinant Tells You
- det(A) = 0: Matrix is singular (no inverse exists)
- det(A) ≠ 0: Matrix is invertible
- |det(A)|: Scale factor for area/volume transformations
- sign(det): Indicates orientation (flip or not)
Properties
- det(AB) = det(A) × det(B)
- det(Aᵀ) = det(A)
- det(A⁻¹) = 1/det(A)
- det(kA) = k^n × det(A) for n×n matrix
Example
A = [3 1] [2 4]
det(A) = 3×4 - 1×2 = 12 - 2 = 10
Since det(A) ≠ 0, A is invertible.
Matrix Inverse
The inverse of matrix A is the matrix A⁻¹ such that AA⁻¹ = A⁻¹A = I.
Requirements
- Matrix must be square
- Determinant must be non-zero (matrix must be invertible)
2×2 Inverse Formula
For A = [a b] [c d]
A⁻¹ = (1/det(A)) × [ d -b] [-c a]
Steps
- Calculate determinant
- Create adjugate matrix (swap a↔d, negate b and c)
- Divide each element by determinant
Example
A = [4 3] [3 2]
det(A) = 4×2 - 3×3 = 8 - 9 = -1
A⁻¹ = (1/-1) × [2 -3] = [-2 3] [-3 4] [3 -4]
Verify: A × A⁻¹ = I
3×3 Inverse
Uses cofactor matrix and adjugate: A⁻¹ = (1/det(A)) × adj(A)
The cofactor matrix involves 2×2 determinants of submatrices.
When Inverse Doesn't Exist
If det(A) = 0:
- Matrix is singular
- Rows/columns are linearly dependent
- System of equations has no unique solution
Transpose
The transpose of a matrix flips it over its diagonal.
Definition
If A is m×n, then Aᵀ is n×m where: (Aᵀ)ᵢⱼ = Aⱼᵢ
Rows become columns, columns become rows.
Example
A = [1 2 3] [4 5 6]
Aᵀ = [1 4] [2 5] [3 6]
Properties
- (Aᵀ)ᵀ = A
- (A + B)ᵀ = Aᵀ + Bᵀ
- (kA)ᵀ = kAᵀ
- (AB)ᵀ = BᵀAᵀ (note the order reversal!)
- det(Aᵀ) = det(A)
Symmetric Matrices
A matrix is symmetric if A = Aᵀ
Example: [1 2 3] [2 4 5] [3 5 6]
Symmetric matrices have real eigenvalues and appear in many applications.
Applications
- Inner products: xᵀy = dot product of vectors
- Covariance matrices (always symmetric)
- Gram matrices in machine learning
Applications of Matrices
Matrices are used throughout mathematics, science, and engineering.
Solving Linear Systems
System: 2x + 3y = 5 4x + y = 3
Matrix form: Ax = b
[2 3][x] = [5] [4 1][y] [3]
Solution: x = A⁻¹b
Transformations in 2D/3D
Rotation by θ: R = [cos θ -sin θ] [sin θ cos θ]
Scaling: S = [sx 0] [0 sy]
Reflection across y-axis: F = [-1 0] [0 1]
Data Science
- Data as matrix (rows = samples, columns = features)
- Covariance matrix for statistical relationships
- Principal Component Analysis (PCA)
- Neural network weights
Computer Graphics
- 3D transformations with 4×4 matrices
- Perspective projection
- Animation and modeling
Physics
- Quantum mechanics (operators as matrices)
- Moment of inertia tensor
- Stress-strain relationships
Economics
- Input-output models
- Markov chains for predictions
- Portfolio optimization
Pro Tips
- 💡Always check dimensions before operations: addition needs same size, multiplication needs compatible.
- 💡Remember: matrix multiplication is NOT commutative (AB ≠ BA).
- 💡Calculate determinant first when finding inverse - if it's 0, stop.
- 💡The identity matrix is the multiplicative identity: AI = IA = A.
- 💡For (AB)ᵀ, remember it equals BᵀAᵀ (order reverses).
- 💡Determinant of inverse is 1/determinant of original.
- 💡Singular matrices (det = 0) have dependent rows/columns.
- 💡Use matrix form for systems of 3+ equations.
- 💡Symmetric matrices equal their transposes (A = Aᵀ).
- 💡Computer graphics relies heavily on 4×4 transformation matrices.
- 💡Practice 2×2 cases first before moving to larger matrices.
- 💡Verify your inverse by checking that A × A⁻¹ = I.
Frequently Asked Questions
Matrix multiplication involves combining rows of A with columns of B in a specific way. When you switch the order (BA instead of AB), you're combining different rows with different columns, giving different results. In fact, even the dimensions might not allow both orders: if A is 2x3 and B is 3x4, AB exists (2x4) but BA doesn't (4 ≠ 2).

