Matrix Calculator
This matrix calculator adds or multiplies rectangular matrices and calculates determinants or inverses for square matrices up to three rows and columns. Paste one row per line, separating entries with spaces, tabs, or commas; the calculator validates shape before performing the operation.
By Dr. Hassan Khames EliwaLast updated
Result
Result matrix (rounded to eight decimal places)
| Column 1 | Column 2 |
|---|---|
| 6 | 8 |
| 10 | 12 |
How it works
Shape is part of the calculation
A matrix is an ordered rectangular collection of numbers. Row and column positions carry meaning, so entries cannot be rearranged for convenience. Every pasted row must contain the same number of entries. Blank interior rows, nonnumeric tokens, and oversized dimensions are rejected rather than padded with zeros. Each entry must be finite and have magnitude at most 1e12.
Addition combines corresponding positions and therefore requires identical shapes. Multiplication has a different rule: the column count of A must equal the row count of B. Each output entry is the dot product of a row from A and a column from B. The output retains A's row count and B's column count. Changing operand order can change the answer or make multiplication impossible.
Square operations need additional care
A determinant is a scalar associated with a square matrix. A zero determinant means the matrix has no inverse in exact arithmetic. The inverse, when it exists, reverses the associated linear transformation. Rectangular matrices do not have the ordinary determinant or inverse offered here; this is not a pseudoinverse tool.
The implementation rescales square matrices by their largest absolute entry, then uses elimination with partial pivoting. At each step it chooses the largest available pivot magnitude in that column. A normalized pivot at or below 1e-12 is treated as numerically singular. Inverse mode returns an error instead of a misleading array of enormous values. Determinant mode returns zero with a warning that this may indicate numerical near-singularity rather than an exactly zero symbolic determinant.
Numerical output is not symbolic algebra
Results use ordinary floating-point arithmetic and are displayed to eight decimal places. Tiny entries can consequently display as zero. Scaling helps the algorithm avoid obvious magnitude problems but cannot recover information already lost in rounded measurements. For sensitive engineering work, inspect conditioning with a dedicated numerical package and keep your source precision. The unused B field is deliberately ignored for determinant and inverse operations.
Worked example
Combining two input tables
Suppose A has rows “1 2” and “3 4”, while B has rows “5 6” and “7 8”. Addition produces rows “6 8” and “10 12”. Both inputs and the result have dimensions 2 × 2. If the same tables describe sequential transformations, select multiplication instead: A times B gives rows “19 22” and “43 50”. The top-left product entry is 1 times 5 plus 2 times 7, not the product of the top-left entries alone.
Reversing a small transformation
Keep A as rows “1 2” and “3 4” and choose determinant. The result is -2. In inverse mode the output rows are “-2 1” and “1.5 -0.5”, again with dimensions 2 × 2. Multiplying A by that inverse gives the identity rows “1 0” and “0 1”. This offers a stronger check than simply checking whether the inverse entries look plausible. No contents of B affect either square-only calculation.
Expert tips
Common mistakes
- Multiplying matching positions. Ordinary matrix multiplication combines whole rows and columns. Element-by-element multiplication is a different operation and is not provided on this page.
- Assuming a numerical warning proves exact singularity. A nearly dependent matrix may be invertible algebraically yet unsafe to invert at the precision used by this calculator.
- Changing row order casually. Swapping rows changes the determinant sign and changes the transformation represented by the matrix. Preserve the order established by your original equations.
Frequently asked questions
Can I paste a rectangular matrix?
Yes, provided every row has the same number of entries and both dimensions fit the page limit. Addition and multiplication support rectangular inputs; determinant and inverse require square inputs.
Why was my inverse rejected?
A pivot was zero or too small relative to the scaled matrix. That indicates exact singularity or numerical instability. Check for duplicate rows, dependent equations, and rounded source values.
Does B matter in determinant mode?
No. Determinant and inverse use only A. B is ignored in those modes, so an old or incomplete second matrix does not block an otherwise valid square calculation.
Are fractions accepted as entries?
Use decimal equivalents or scientific notation. Slash expressions are not parsed, and arithmetic expressions are not evaluated. This avoids ambiguity between pasted data and executable mathematical syntax.
Can this solve larger systems?
No. The small dimension limit keeps the interface readable and validation predictable. Larger or ill-conditioned systems belong in a numerical environment that reports residuals and conditioning explicitly.
Related calculators
Sources and standards
About the author
Dr. Hassan Khames Eliwa holds a PhD in Construction & Built Environment and has more than 20 years of international project controls experience. He is Director of Eliwa Project Controls Limited in Auckland and founder of PMMilestone.org and PMMilestone.com.
Buy me a coffee