GALAXY OF TOOLS

SCIENCE SECTOR

Matrix Calculator

Add, multiply, invert and row-reduce matrices up to 10×10 with exact fractions, steps and LaTeX/CSV copy.

Try:
Matrix A ×
Paste A from text
Show numbers as

Entries can be whole numbers, decimals (0.5) or fractions (3/4). All arithmetic is exact — no floating-point drift.

Working / steps

    Runs entirely in your browser. Nothing you enter or upload is sent to a server.

    A matrix calculator that works in exact fractions and shows its working

    This matrix calculator handles the operations that come up in linear algebra courses, engineering and data work: addition, subtraction and multiplication of two matrices, scalar multiples and integer powers, the transpose, the inverse, the determinant, rank, trace, the reduced row echelon form (RREF) and eigenvalues. Matrices can be any size up to 10×10, typed into a resizable grid or pasted as plain text.

    Unlike spreadsheet formulas, every calculation here is done with exact rational arithmetic, so an inverse that should contain ⅓ shows 1/3, not 0.33333333, and a determinant that should be zero really is zero. Switch to decimals whenever you want them. Row operations are listed step by step with a snapshot of the matrix after each pivot, which makes the page useful for checking homework as well as for getting an answer.

    Everything runs in your browser. Only the eigenvalue routine for matrices larger than 3×3 fetches a small numerical library (math.js) from a CDN the first time it is needed.

    How to use the Matrix Calculator

    1. Pick the size of matrix A with the two size menus (rows × columns) and type the entries. Whole numbers, decimals such as 0.5 and fractions such as 3/4 are all accepted.
    2. For a faster start, open “Paste A from text” and paste rows separated by new lines (or a [[1,2],[3,4]] literal), then press “Use this text for A”.
    3. Choose an operation. Matrix B appears only for A + B, A − B and A × B; the scalar/power box appears only for k·A and Aⁿ.
    4. Read the answer in the result panel. Toggle “Fractions” or “Decimals” at any time — the working updates too.
    5. Open the working section to follow the row operations, then use “Copy LaTeX” for a document or “Copy CSV” for a spreadsheet. “Use result as A” lets you chain operations, for example invert then multiply.

    Matrix Calculator features

    Exact arithmetic

    Entries are stored as fractions with arbitrary-precision integers, so results such as 7/12 or −1/90 appear exactly and the determinant of a singular matrix is exactly 0.

    Step-by-step row reduction

    Inverse, determinant, rank and RREF show every pivot: swaps, scalings and eliminations, each followed by the matrix at that stage.

    Eigenvalues with exact forms where possible

    2×2 eigenvalues come out as surds such as (3 ± √5)/2; 3×3 matrices are solved exactly when they have a rational eigenvalue; bigger matrices are solved numerically with math.js.

    Chaining

    Send any matrix result back into A with one click to compute, for example, (Aᵀ)⁻¹ or A⁻¹B.

    LaTeX and CSV export

    Results copy as a pmatrix block for LaTeX documents or as comma-separated rows for spreadsheets and code.

    Clear error messages

    Size mismatches, singular matrices and non-square inputs are explained rather than just refused.

    Which operations need which shapes?

    Matrix operations are picky about dimensions. The table below lists the rule the calculator checks before computing, together with the size of the answer.

    OperationRequirementResult size
    A + B, A − BSame sizeSame as A
    A × BColumns of A = rows of Brows(A) × cols(B)
    AᵀAnycols(A) × rows(A)
    A⁻¹, det, trace, Aⁿ, eigenvaluesSquare (n × n)n × n, or a number
    Rank, RREFAnyNumber, or same size as A

    Worked example: inverting a 2×2 matrix

    Take A = [[2, 1], [1, 1]]. Its determinant is 2·1 − 1·1 = 1, so an inverse exists. Writing the augmented matrix [A | I] and row-reducing: divide row 1 by 2 to get the pivot 1, subtract row 1 from row 2, scale row 2 by 2, then clear the entry above the second pivot. The right half becomes A⁻¹ = [[1, −1], [−1, 2]]. The calculator confirms the answer by showing A·A⁻¹, which must equal the identity.

    For a 2×2 matrix [[a, b], [c, d]] there is also the shortcut A⁻¹ = (1/(ad − bc)) · [[d, −b], [−c, a]]. For 3×3 and larger, Gauss–Jordan elimination (what this tool does) is both faster and less error-prone than the adjugate method.

    Reading the RREF, rank and eigenvalue results

    Need a full cofactor expansion rather than row reduction? The determinant calculator writes it out. To solve a system of linear equations directly from the equations, use the equation solver; for single quadratics the quadratic equation solver gives exact roots.

    • RREF — each non-zero row starts with a leading 1 (a pivot), pivots move right as you go down, and every pivot column is otherwise zero. It is unique for a given matrix, so it is a reliable way to compare answers.
    • Rank — the number of pivots, which equals the number of linearly independent rows (or columns). Nullity = columns − rank gives the dimension of the solution space of Ax = 0.
    • Eigenvalues — the roots of the characteristic polynomial det(λI − A), found here with the Faddeev–LeVerrier method in exact arithmetic. Their sum is the trace and their product is the determinant — a quick sanity check. Complex eigenvalues appear for rotations and oscillating systems and are shown as a ± bi.
    • Singular — a square matrix with determinant 0 has no inverse; the tool says so and still shows the determinant and the RREF so you can see which rows are dependent.

    Matrix Calculator FAQ

    Can the matrix calculator show steps for the inverse?

    Yes. Choose “Inverse A⁻¹” and open the working section: it shows the augmented matrix [A | I], every row operation, the matrix after each pivot and the final check A × A⁻¹ = I.

    Why do I see fractions instead of decimals?

    The calculator works in exact fractions so that nothing is lost to rounding. Select “Decimals” above the result to see the same values rounded to six decimal places; LaTeX and CSV copies follow the selected format.

    How do I enter a matrix quickly?

    Open “Paste A from text” and paste rows on separate lines with entries separated by spaces or commas, or paste a JavaScript/Python style list such as [[1,2],[3,4]]. The grid resizes to match.

    What is the largest matrix it can handle?

    Up to 10 rows by 10 columns for every operation. Eigenvalues for 4×4 and larger are computed numerically; everything else stays exact.

    Does it compute eigenvectors?

    Not yet — the eigenvalue mode returns the eigenvalues (exact for 2×2 and many 3×3 matrices, numeric otherwise). For an eigenvector of λ, subtract λ from the diagonal, run RREF and read off the null space.

    Is my data uploaded anywhere?

    No. The arithmetic runs in JavaScript in your browser. The only network request is the optional download of math.js for large eigenvalue problems.

    You might also need