🔲 Matrix Calculator

Add, subtract and multiply matrices, scalar multiply, raise a matrix to a power, and compute the transpose, determinant and inverse of matrices up to 5×5 — with step-by-step work.

🔲 Matrix Addition / Subtraction
Matrix A
Matrix B
Result

🔲

Set the size and values of Matrix A and Matrix B, choose + or −, then calculate

🔲 Matrix Multiplication (A × B)
Matrix A
Matrix B

Multiplication A×B needs the columns of A to equal the rows of B.

🔢 Scalar Multiply Matrix A
A × B Result
🔲

Set the size and values of Matrix A and Matrix B, then calculate A × B

🔲 Power of a Matrix (Aᵏ)

k can be 0 (identity), positive (repeated multiplication), or negative (power of the inverse) — only if A is invertible.

Aᵏ Result
🔲

Choose a square matrix size, fill in the values and an exponent, then calculate Aᵏ

🔲 Transpose of a Matrix (Aᵀ)
Aᵀ Result

🔲

Choose the size, fill in the values, then calculate the transpose (rows and columns don't need to be equal)

🔲 Determinant of a Matrix (det A)
Result
Determinant
🔲

Choose a square matrix size and fill in the values to calculate its determinant

🔲 Inverse of a Matrix (A⁻¹)
Result
Determinant
Inverse of A
🔲

Choose a square matrix size and fill in the values to calculate its inverse

Guide

About the Matrix Calculator

Last updated: July 2026 · Reviewed by the NeftCal editorial team

This free matrix calculator handles the six core operations of linear algebra in one tool: addition, subtraction, and scalar multiplication of matrices, matrix-by-matrix multiplication, raising a square matrix to an integer power, transposing a matrix, computing its determinant via cofactor expansion, and finding its inverse through the adjugate method — for matrices up to 5×5, with full step-by-step working shown. Matrices are rectangular arrays of numbers that represent linear transformations, systems of equations, and multi-dimensional data, making this 2x2 matrix calculator and 3x3 matrix calculator equally useful for a quick homework check or a deeper linear algebra problem. Every calculation shows its reasoning, so you can see exactly how the result was derived rather than just the final numbers.

What This Matrix Calculator Computes

The tool offers six distinct modes. Add/Subtract combines two matrices of identical dimensions entry-by-entry. Multiply computes the matrix product A×B (requiring A's columns to equal B's rows) and also includes a separate scalar multiplication card for k×A. Power of a Matrix raises a square matrix to an integer exponent, including negative exponents via the inverse. Transpose flips any matrix (square or rectangular) over its main diagonal. Determinant computes the scalar determinant of a square matrix using cofactor expansion. Inverse computes A⁻¹ via the adjugate method, flagging singular matrices that have no inverse.

Who Should Use This Calculator

This tool is built for students learning linear algebra, engineers solving systems of linear equations, computer graphics and game developers working with transformation matrices, machine learning practitioners studying the matrix operations behind neural networks, and economics or statistics students modeling multi-variable relationships. It's equally useful for quickly checking a hand-computed determinant or inverse before relying on it further.

Why Matrix Operations Matter

Matrices compactly represent systems of linear equations, geometric transformations, and multi-dimensional datasets, making matrix operations the backbone of linear algebra. The determinant tells you at a glance whether a system of equations has a unique solution (non-zero determinant) or not (singular, zero determinant). Matrix multiplication is the core operation inside computer graphics rendering pipelines and machine learning models, where inputs, weights, and transformations are all represented as matrices multiplied together.

Real-World Applications

Computer graphics represents rotation, scaling, and translation as matrices applied to points in 2D or 3D space. Machine learning uses matrix multiplication as the fundamental operation inside neural network layers and linear regression. Engineers solve systems of linear equations describing circuits, structural loads, or control systems using matrix methods. Economists model input-output relationships between interacting sectors using matrices. Some classical cryptography schemes, like the Hill cipher, use matrix multiplication and inversion for encoding and decoding messages.

Tips for Accurate Results

  • Double-check matrix dimensions before multiplying — the columns of A must equal the rows of B, or the multiplication is undefined.
  • Remember that matrix addition and subtraction require identical dimensions on both matrices, unlike multiplication.
  • Before computing an inverse, check the determinant first — a zero determinant means the matrix is singular and has no inverse.
  • Matrix multiplication is not commutative — A×B generally does not equal B×A, so keep operand order consistent with your problem.
  • For negative matrix powers, confirm the matrix is invertible (non-zero determinant) before expecting a result.
Formula

The Matrix Formulas, Explained

How this matrix calculator computes each of its six operations

Addition / Subtraction
(A ± B)[i][j] = A[i][j] ± B[i][j] (same dimensions required)

Scalar Multiplication
(kA)[i][j] = k × A[i][j]

Matrix Multiplication
(AB)[i][j] = Σₖ A[i][k] × B[k][j] (columns of A must equal rows of B)

Power
A⁰ = I; Aᵏ = A×A×…(k factors); A⁻ᵏ = (A⁻¹)ᵏ

Transpose
Aᵀ[i][j] = A[j][i]

Determinant (2×2)
det(A) = ad − bc; larger matrices use cofactor expansion

Inverse (2×2)
A⁻¹ = (1/det(A)) × [[d,−b],[−c,a]]; larger matrices use the adjugate method

Where:
A, B = the matrices being operated on.
k = a scalar (for scalar multiplication) or an integer exponent (for matrix power).
det(A) = the determinant, a scalar indicating whether A is invertible (nonzero) or singular (zero).
adj(A) = the adjugate, the transpose of the cofactor matrix, used to compute the inverse.
🔲

Not Commutative

Unlike ordinary multiplication, A × B ≠ B × A in general for matrices — order matters.

🧮

Cofactor Expansion

Determinants of matrices larger than 2×2 expand recursively along a row using smaller minors and alternating signs.

🚫

Singular = No Inverse

A zero determinant means the matrix is singular; the inverse formula would require dividing by zero, so no inverse exists.

⚙️ Why This Formula Works

Matrix multiplication is defined as a set of dot products because it represents composing linear transformations — applying transformation B and then A to a vector is equivalent to applying the single combined matrix A×B. The determinant measures how a transformation scales area or volume; when it's zero, the transformation collapses space into a lower dimension, which is exactly why no inverse (undo) transformation can exist.

🎯 When to Use Each Mode

  • Add/Subtract: combining or comparing datasets of the same shape
  • Multiply: composing transformations or computing weighted combinations
  • Determinant/Inverse: checking solvability of a linear system or "undoing" a transformation

📋 Assumptions

  • All entries are treated as real numbers, including decimals and negatives
  • Determinant, inverse, and power operations assume a square matrix
  • Matrix size is limited to 5×5 in this tool

⚠️ Limitations of the Formula

  • Addition/subtraction require identical dimensions; mismatches are flagged, not silently computed
  • Multiplication requires A's columns to equal B's rows, or the operation is undefined
  • Negative powers and inverses require a non-zero determinant (an invertible matrix)
Walkthrough

Step-by-Step: How to Use the Matrix Calculator

From choosing an operation to verifying the result

Choose an operation

Pick Add/Subtract, Multiply, Power, Transpose, Determinant, or Inverse from the mode tabs.

Set the matrix dimensions

Choose the number of rows and columns (up to 5×5) for each matrix using the size selectors.

Fill in the matrix values

Enter a number into every cell of the matrix grid — decimals and negative values are accepted.

Click "Calculate"

The calculator validates the dimensions for your chosen operation and computes the result instantly.

Read the result matrix and steps

Review the resulting matrix, determinant, or inverse, along with the explanation of how it was derived.

Verify manually (optional)

For small matrices, recompute one or two entries by hand to confirm the result matches.

Example

Worked Example

Multiplying two 2×2 matrices, then checking invertibility

Scenario

Given A = [[1,2],[3,4]] and B = [[5,6],[7,8]], find A × B, then determine whether A itself is invertible.

Matrix A[[1,2],[3,4]]
Matrix B[[5,6],[7,8]]
det(A)−2
Step 1 — Compute result[0][0]: row 1 of A · column 1 of B = (1×5)+(2×7) = 5+14 = 19.
Step 2 — Compute result[0][1]: row 1 of A · column 2 of B = (1×6)+(2×8) = 6+16 = 22.
Step 3 — Compute result[1][0] and result[1][1]: (3×5)+(4×7) = 43; (3×6)+(4×8) = 50 → A×B = [[19,22],[43,50]].
Step 4 — Compute det(A): for 2×2, det(A) = (1×4)−(2×3) = 4−6 = −2.
Step 5 — Check invertibility: since det(A) = −2 ≠ 0, A is invertible; A⁻¹ = (1/−2)×[[4,−2],[−3,1]] = [[−2,1],[1.5,−0.5]].
A × B
[[19,22],[43,50]]
det(A)
−2
A⁻¹
[[−2,1],[1.5,−0.5]]

Explanation: Each entry of A×B is a dot product between a row of A and a column of B, which is why matching inner dimensions (A's columns = B's rows) is required. Because det(A) is nonzero, A is invertible — multiplying A by its computed inverse A⁻¹ would return the identity matrix [[1,0],[0,1]], confirming the inverse is correct.

Interpretation

Understanding Your Matrix Result

What each output actually means

ResultWhat It MeansExample
Sum/Difference matrixEntry-by-entry combination of two same-sized matrices[[1,2],[3,4]] + [[5,6],[7,8]] = [[6,8],[10,12]]
Product matrix (A×B)Each entry is a dot product of a row of A and a column of B[[1,2],[3,4]] × [[5,6],[7,8]] = [[19,22],[43,50]]
Determinant = 0The matrix is singular — no inverse exists, rows/columns are linearly dependent[[1,2],[2,4]] has det = 0
Determinant ≠ 0The matrix is invertible — a unique inverse exists[[1,2],[3,4]] has det = −2, invertible
Inverse matrix (A⁻¹)Satisfies A × A⁻¹ = the identity matrixInverse of [[1,2],[3,4]] is [[−2,1],[1.5,−0.5]]

Reading a singular result: if the calculator reports "This matrix is singular (determinant = 0) and has no inverse," that's a valid mathematical outcome, not an error — it means the matrix's rows or columns are linearly dependent.

Typical ranges: determinant values can be any real number, positive, negative, or zero; the sign indicates orientation-preserving (positive) vs. orientation-reversing (negative) transformations in geometric contexts.

Manual verification: multiply your computed inverse back by the original matrix — the product should equal the identity matrix (1s on the diagonal, 0s elsewhere), confirming the inverse is correct.

Use Cases

Practical Use Cases for the Matrix Calculator

Where matrix operations are genuinely useful

🎓

School & college linear algebra

Practice matrix addition, multiplication, determinants, and inverses for coursework.

📝

Competitive exam prep

Quickly verify matrix calculations for engineering entrance and competitive math exams.

🎮

Computer graphics & game dev

Represent rotation, scaling, and translation transformations as matrices applied to 3D points.

🤖

Machine learning

Understand matrix multiplication as the core operation inside neural network layers.

⚙️

Engineering systems

Solve systems of linear equations representing circuits, structures, or control systems.

📊

Economics & input-output modeling

Model relationships between multiple interacting economic sectors using matrices.

🔐

Cryptography

Study classical matrix-based encryption schemes like the Hill cipher.

📈

Data science

Represent and transform datasets as matrices for statistical and machine learning pipelines.

🧑‍🏫

Teaching aid

Generate instant, step-by-step matrix examples for classroom demonstrations.

🧑‍💻

Programmer verification

Sanity-check a custom matrix library's multiplication, determinant, or inverse implementation.

🧩

Puzzles & recreational math

Explore matrix properties like singularity, symmetry, and transformation composition.

🛰️

Robotics & control systems

Use matrices to represent state transitions and transformations in robotics and control theory.

🛡️

Cybersecurity education

Demonstrate how matrix transformations and their inverses relate to classical encoding schemes.

Pros & Cons

Advantages and Limitations

What this matrix calculator does well, and where it has boundaries

✅ Advantages

  • Free, instant, and requires no signup or account
  • Six operations in one tool: add/subtract, multiply, power, transpose, determinant, inverse
  • Includes a separate scalar multiplication card alongside matrix multiplication
  • Shows step-by-step working, not just the final result
  • Supports matrices up to 5×5, including rectangular (non-square) matrices for applicable operations
  • Clearly flags dimension mismatches instead of silently computing wrong results
  • Detects singular matrices and explains why no inverse exists
  • Supports negative matrix powers via the inverse when applicable
  • Runs entirely in your browser — no data ever leaves your device
  • Useful across school, engineering, and computer science contexts
  • Fast-loading and fully mobile-friendly
  • Free to use as many times as needed, with no calculation limit

⚠️ Limitations

  • Supports only fixed sizes up to 5×5, not arbitrary n×n matrices
  • Determinant and inverse operations require a square matrix
  • Negative matrix powers are only defined when the matrix is invertible
  • Displays decimal results rounded for readability, which can hide tiny precision differences on repeated calculations
  • Does not solve full systems of linear equations (Ax = b) directly, only the underlying matrix operations
  • Does not compute eigenvalues, eigenvectors, or matrix decompositions (LU, QR, SVD)
  • Very large or ill-conditioned matrices can accumulate floating-point rounding error in cofactor expansion
Reference

Matrix Operations Compared

When to use addition, multiplication, determinant, inverse, and transpose

OperationRequires Square Matrix?When to Use
Addition / SubtractionNo (needs matching dimensions)Combining or comparing datasets of the same shape
MultiplicationNo (needs A's cols = B's rows)Composing transformations or computing weighted sums
DeterminantYesChecking if a system of equations has a unique solution
InverseYes"Undoing" a transformation or solving Ax = b directly
TransposeNoSwitching between row and column orientation of data

Common Mistakes and Expert Tips

❌ Common Mistakes

  • Assuming matrix multiplication is commutative (A×B = B×A) — it generally is not
  • Trying to add or subtract matrices with different dimensions
  • Forgetting to check the determinant before assuming a matrix has an inverse
  • Mixing up the order of operands when computing A×B vs B×A
  • Confusing scalar multiplication (k×A) with matrix-by-matrix multiplication (A×B)
  • Applying determinant, inverse, or power operations to a non-square matrix

💡 Expert Tips & Best Practices

  • Always verify matrix dimensions before attempting multiplication — mismatches are the most common error
  • Compute the determinant first when you need an inverse — a zero result saves you the work
  • Pair this tool with the Fraction Calculator when your matrix entries come from fraction-based problems
  • Use the Scientific Calculator for any trigonometric values needed inside a rotation matrix
  • Cross-check a computed inverse by multiplying it back against the original matrix — the result should be the identity matrix
📝

Summary: This matrix calculator gives you an instant, free way to add, subtract, multiply, and scalar-multiply matrices, raise them to a power, transpose them, and compute their determinant and inverse — all with step-by-step working shown. Pair it with the Scientific Calculator and Fraction Calculator for a fuller toolkit of algebra and linear algebra tools.

FAQ

Frequently Asked Questions

Common questions about matrix arithmetic and operations

Can you add matrices of different sizes?
No. Matrix addition and subtraction require both matrices to have exactly the same number of rows and the same number of columns. For example, you can add two 2×3 matrices, but you cannot add a 2×3 matrix to a 3×2 matrix. Each entry is added individually: result[i][j] = A[i][j] + B[i][j].
How do you multiply two matrices?
To multiply matrix A (m×n) by matrix B (n×p), the number of columns in A must equal the number of rows in B. Each entry of the result is the dot product of a row of A and a column of B: result[i][j] = Σ A[i][k]×B[k][j]. For example, [[1,2],[3,4]] × [[5,6],[7,8]] = [[19,22],[43,50]].
How do you raise a matrix to a power?
A matrix power Aᵏ (k a positive integer) means multiplying the square matrix A by itself k times: A² = A×A, A³ = A×A×A, and so on. A⁰ is defined as the identity matrix. A negative power A⁻ᵏ is (A⁻¹)ᵏ — the inverse of A raised to the power k — so it's only defined when A is invertible (determinant ≠ 0).
What is the determinant of a matrix used for?
The determinant is a single number that tells you whether a matrix is invertible (non-zero determinant) or singular (zero determinant). It's computed by cofactor expansion: for a 2×2 matrix [[a,b],[c,d]], determinant = a×d − b×c. Larger matrices expand recursively along a row using smaller minors.
How do you find the inverse of a matrix?
The inverse of matrix A, written A⁻¹, satisfies A × A⁻¹ = the identity matrix. It's calculated as A⁻¹ = (1/determinant) × adjugate(A), where the adjugate is the transpose of the matrix of cofactors. For example, the inverse of [[1,2],[3,4]] (determinant −2) is [[-2,1],[1.5,-0.5]].
What does it mean for a matrix to be singular?
A matrix is singular when its determinant equals zero. Singular matrices have no inverse, because the inverse formula divides by the determinant — and division by zero is undefined. A singular matrix's rows (or columns) are linearly dependent.
What is the transpose of a matrix?
The transpose flips a matrix over its main diagonal, turning rows into columns and columns into rows: transpose(A)[i][j] = A[j][i]. A 2×3 matrix becomes a 3×2 matrix after transposing. Unlike determinant and inverse, transpose works on any matrix, not just square ones.
What size matrices does this calculator support?
This tool supports matrices from 1×1 up to 5×5. Addition, subtraction, and multiplication can involve rectangular (non-square) matrices as long as the dimension rules are satisfied, while power, determinant, and inverse require a square matrix.
Is matrix multiplication commutative?
No. In general, A × B does not equal B × A for matrices, even when both products are defined. Order matters in matrix multiplication, unlike multiplication of ordinary numbers, because each entry depends on matching rows of the first matrix to columns of the second.
What is scalar multiplication of a matrix?
Scalar multiplication multiplies every single entry of a matrix by the same constant k: (kA)[i][j] = k × A[i][j]. For example, multiplying [[1,2],[3,4]] by the scalar 2 gives [[2,4],[6,8]]. It is much simpler than matrix-by-matrix multiplication since no dot products are involved.
What is the identity matrix?
The identity matrix (I) has 1s on the main diagonal and 0s everywhere else, such as [[1,0],[0,1]] for 2×2. It behaves like the number 1 in matrix multiplication: A × I = A for any compatible matrix A. It is also defined as A⁰ for any square matrix A in the power operation.
Can a negative power of a matrix be computed?
Yes, but only if the matrix is invertible (determinant ≠ 0). A⁻ᵏ is defined as (A⁻¹)ᵏ — the inverse matrix multiplied by itself k times. If the determinant is zero, negative powers are undefined because the inverse itself doesn't exist.
How is the determinant of a 3×3 matrix calculated?
A 3×3 determinant is computed by cofactor expansion along the first row: det(A) = a₁₁×M₁₁ − a₁₂×M₁₂ + a₁₃×M₁₃, where each Mᵢⱼ is the 2×2 determinant of the minor formed by deleting row 1 and column j. This recursive process (expansion by minors) generalizes to any size square matrix.
Why does matrix multiplication require matching inner dimensions?
Each entry of the product is a dot product between a row of A and a column of B, which only works if the row and column have the same number of elements. That means the number of columns in A must equal the number of rows in B — otherwise the dot products can't be computed.
What are practical uses of matrices in computer graphics and machine learning?
Computer graphics uses matrices to represent rotation, scaling, and translation transformations applied to 2D or 3D points. Machine learning represents datasets, weights, and layer transformations as matrices, with matrix multiplication as the core operation inside neural network forward passes.
How do you check if a matrix inverse is correct?
Multiply the original matrix A by its computed inverse A⁻¹ — the result should be the identity matrix (1s on the diagonal, 0s elsewhere), within rounding tolerance for decimal entries. If the product isn't the identity matrix, the inverse calculation has an error.
Learn More

Authoritative Resources on Linear Algebra

Trusted educational references to go deeper on matrices and linear algebra

Related Calculators

Explore other math tools