Connect via MCP →

Enter Calculation

Square system A is n by n, vector b has length n. Allowed 2 to 10.
One row per line, numbers separated by spaces or commas.
Length-n list, numbers separated by spaces or commas.

Formula

Show calculation steps (1)
  1. Determinant from LU Pivots

    Determinant from LU Pivots: N-by-N System of Linear Equations Solver (LU Decomposition)

    After Gaussian elimination with partial pivoting, det(A) equals the product of the U diagonal pivots, with sign flipped once per row swap.

Advertisement

Results

Solution vector x
x1 = 2, x2 = 3, x3 = -1
System size (n) 3
Determinant of A -1
Method LU decomposition with partial pivoting

What this calculator does

This tool solves a system of n linear equations in n unknowns, written compactly as \(\mathbf{A}\cdot\mathbf{x} = \mathbf{b}\), where A is an n×n coefficient matrix, x is the unknown vector, and b is the constant vector. It returns the unique solution vector x together with the determinant of A. The method is pure linear algebra and works identically anywhere — there is no country or unit dependence; every entry is just a real number.

Matrix-vector equation A x equals b with a square coefficient matrix, an unknown vector, and a right-hand-side vector
A system of n linear equations written compactly as A·x = b.

How to use it

Set n (the number of equations and unknowns). Type the coefficient matrix A one row per line, with numbers separated by spaces or commas, then enter the constant vector b as a length-n list. Pick a display precision and solve. Negative, decimal and fractional-looking decimals are all accepted. If A has the same number of rows and columns as n and b matches that length, you get the solution; otherwise the tool reports a dimension mismatch.

The method explained

The solver performs Gaussian elimination with partial pivoting, which is mathematically equivalent to the LU decomposition PA = LU. For each column it selects the largest-magnitude available pivot to keep the arithmetic numerically stable, eliminates the entries below the pivot, and then back-substitutes from the last unknown upward. If a pivot is effectively zero, the determinant is zero, the matrix is singular, and the system has no unique solution — the tool flags this instead of dividing by zero.

$$\begin{gathered} \mathbf{A}\,\mathbf{x} = \mathbf{b}, \qquad \mathbf{A} = \mathbf{L}\mathbf{U} \\[1.5em] \text{solve}\quad \left\{ \begin{aligned} \mathbf{L}\mathbf{y} &= \mathbf{b} \quad(\text{forward}) \\ \mathbf{U}\mathbf{x} &= \mathbf{y} \quad(\text{back substitution}) \end{aligned} \right. \end{gathered}$$ $$\det(\mathbf{A}) = (-1)^{s}\prod_{k=1}^{n} u_{kk}$$
Square matrix A factored into a lower triangular matrix L and an upper triangular matrix U
LU decomposition factors A into a lower-triangular L and an upper-triangular U.

Worked example

Consider \(2x + y - z = 8\), \(-3x - y + 2z = -11\), \(-2x + y + 2z = -3\). So \(\mathbf{A} = [[2,1,-1],[-3,-1,2],[-2,1,2]]\) and \(\mathbf{b} = [8,-11,-3]\). Elimination yields \(x = 2\), \(y = 3\), \(z = -1\). Checking the first equation:

$$2(2) + 3 - (-1) = 4 + 3 + 1 = 8$$

Correct.

FAQ

What if the determinant is zero? The matrix is singular, meaning the equations are dependent or inconsistent; there is no single solution, so the calculator reports a singular matrix.

Why partial pivoting? Choosing the largest pivot avoids amplifying rounding error, giving accurate results even for awkward matrices.

Can the solution be non-integer? Yes. Solutions are computed in floating point and may be decimals; the display precision setting controls how many significant figures are shown.

Last updated: