Linear Algebra

Matrix Calculator

Add, multiply, determinant, inverse, rank, row-echelon form and solving linear systems — exact with fractions and step-by-step.

Matrix A
Rows2
Columns2
Matrix B
Rows2
Columns2

Explanation

What this tool does

The matrix calculator works over the rational numbers: every entry is kept as an exact fraction, so results are exact — 1/3 never drifts to 0.3333. Enter a matrix, pick an operation, and (where it helps) read the worked steps.

Core operations

For matrices AA and BB of compatible sizes:

(A+B)ij=Aij+Bij,(AB)ij=kAikBkj.(A + B)_{ij} = A_{ij} + B_{ij}, \qquad (AB)_{ij} = \sum_{k} A_{ik} B_{kj}.

Matrix multiplication is not commutativeABAB and BABA usually differ — so both are offered.

Gaussian elimination

Row reduction underlies rank, the determinant, the inverse, and solving systems. Each step is one of three elementary row operations: swap two rows, scale a row, or add a multiple of one row to another. Reducing to reduced row-echelon form (a leading 1 in each pivot column, zeros elsewhere in that column) exposes the rank and the solution set.

Determinant

Reducing AA to upper-triangular form by row operations, the determinant is the product of the diagonal, with a sign flip for each row swap:

det(A)=(1)siuii.\det(A) = (-1)^{s} \prod_i u_{ii}.

A zero on the diagonal after elimination means det(A)=0\det(A) = 0 and AA is singular.

Inverse

Augment AA with the identity and run Gauss–Jordan elimination: [AI][IA1][\,A \mid I\,] \to [\,I \mid A^{-1}\,]. If the left block cannot reach II, the matrix is singular and has no inverse.

Solving Ax=bAx = b

Row-reduce the augmented matrix [Ab][\,A \mid b\,]. A pivot in the bb column means no solution. Otherwise the pivots fix the basic variables; any free columns give a null-space basis, so the full solution is one particular vector plus any combination of those basis vectors.

Worked example

With A=[2113]A = \begin{bmatrix} 2 & 1 \\ 1 & 3 \end{bmatrix} and b=[34]b = \begin{bmatrix} 3 \\ 4 \end{bmatrix}, elimination gives the unique solution x=[11]x = \begin{bmatrix} 1 \\ 1 \end{bmatrix}, and det(A)=5\det(A) = 5.