Matrix Calculator with Steps: Multiply, Inverse, Determinant, Eigenvalues, SVD and Machine Learning

Free matrix calculator with steps: type or paste matrices into a grid (from Excel, MATLAB, NumPy or LaTeX), then multiply, invert, find the determinant, rank, RREF, eigenvalues, SVD and QR, or solve A·x = b. Also softmax, activations, a dense layer and attention for machine learning.

Type into the grid, or paste a whole table into any cell: from Excel or Google Sheets, MATLAB, NumPy, LaTeX or Mathematica. Cells can hold fractions and expressions such as 1/3, pi/4 or sqrt(2). Blank cells count as 0.

Edit as
Try an example:

A matrix calculator that shows the working

Type or paste your matrices, pick an operation and see the answer as a matrix, with the steps where there are steps. It does the usual linear algebra: add, subtract and multiply matrices, multiply by a number, transpose, powers, the determinant, the inverse, rank, trace, row reduction (RREF), solving a system of linear equations, eigenvalues and eigenvectors, the singular value decomposition (SVD) and the QR decomposition. Click any number in a product to see which row and column made it.

Machine learning

Matrices are also how neural networks compute. A layer is y = activation(W·x + b), a language model's attention is softmax(Q·Kᵀ/√d)·V, and training changes the numbers inside the matrices. The Machine learning group in the list of operations does these steps with your own numbers: softmax with temperature, the common activation functions (ReLU, sigmoid, tanh, GELU), one dense layer and one attention step, with an optional causal mask. Dot products, lengths and cosine similarity (how embeddings are compared) are under Vectors.

Typing and pasting a matrix

Each matrix is a grid. The + and − buttons add or remove rows and columns. Tab and the arrow keys move between cells, and Enter goes down a row. Zero, Identity, Random, Clear and Transpose change the whole grid at once, and Undo puts it back. Blank cells count as 0.

To paste, copy a block of cells from a spreadsheet, or a matrix written as text, and paste it into a cell. Pasting into the first cell replaces the whole matrix; pasting further in fills from that cell and makes the grid bigger if needed. The page reads:

  • spreadsheet cells from Excel, Google Sheets or Numbers (a header row or a first column of labels is skipped)
  • plain text: 1 2; 3 4, or one row per line with spaces or commas
  • MATLAB and Octave: [1 2; 3 4]
  • NumPy and Python: [[1, 2], [3, 4]] and np.array([[1, 2], [3, 4]])
  • LaTeX: \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}, and pmatrix, vmatrix and the others
  • Mathematica: {{1, 2}, {3, 4}}
  • Markdown tables

Prefer typing? Choose Edit as: Text (or Grid + text). The text box and the grid stay in step. A result can be copied as text, as spreadsheet cells, as LaTeX or as NumPy code, or used as A or B for the next step.

Questions

Why do the shapes have to match?

To multiply A × B, A's columns must equal B's rows, because each result number is a row of A paired up, one by one, with a column of B. Click any number in a product: its row of A and column of B light up in the grids and the sum is written out. The result has A's rows and B's columns. This is also why a network layer with 784 inputs and 128 neurons has a 128 × 784 weight matrix.

How do I solve a system of linear equations?

Put the coefficients in A (one equation per row) and the right-hand sides in b, then choose Solve A·x = b. For example 2x + y = 3 and x + 3y = 5 is A = [2 1; 1 3] and b = [3; 5], which gives x = 0.8 and y = 1.4. The page shows every row operation. If b has several columns, each column is solved as its own system.

What is the inverse for?

The inverse undoes a matrix (A⁻¹·A = I). It exists only when the determinant is not 0. Solving A·x = b is the same as x = A⁻¹·b, which is how the normal equation of linear regression works. The page shows the row operations that get there.

What do eigenvalues and the SVD tell you?

Eigenvectors are the directions a matrix only stretches; the eigenvalues say by how much. For a symmetric matrix such as a covariance matrix they give the principal components (PCA). The SVD does the same job for any rectangular matrix and is behind image compression, recommendations and low-rank fine-tuning (LoRA).

What do softmax and temperature do?

Softmax turns any list of numbers (scores) into probabilities that add up to 1 by giving bigger scores much bigger shares. A low temperature makes the biggest score win almost every time; a high temperature spreads the probability out. Language models use exactly this to pick the next word.

What can I type in a cell?

Numbers (1.5, -2, 3e-4), fractions (1/3), pi and e, the signs + − × ÷ and ^, square roots (sqrt(2) or √2), sin, cos and tan (in radians, or add ° for degrees), exp, ln and percentages such as 50%. 2pi means 2 × pi. A cell that is not a number is outlined in red.

Is the working exact?

Numbers are double-precision decimals, so results can be off in the 15th digit and tiny values show as 0. Fractions are found for display (for example 0.3333 shows as 1/3 with Show fractions on). Everything is computed in your browser; nothing is sent anywhere.

Comments
Advertisement