Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Systems of Linear Equations






Solving Ax = b

A linear system is a collection of linear equations in several unknowns. Writing it in matrix form as Ax = b transforms the problem into a question about matrices: is b in the column space of A, and if so, what are the weights? Row reduction answers both questions systematically, and the rank of the coefficient matrix determines whether the solution exists, whether it is unique, and what the solution set looks like.



What a Linear System Is

A linear system is a set of mm equations in nn unknowns where each equation is a linear combination of the unknowns equal to a constant:

a11x1+a12x2++a1nxn=b1a_{11}x_1 + a_{12}x_2 + \cdots + a_{1n}x_n = b_1

a21x1+a22x2++a2nxn=b2a_{21}x_1 + a_{22}x_2 + \cdots + a_{2n}x_n = b_2

\vdots

am1x1+am2x2++amnxn=bma_{m1}x_1 + a_{m2}x_2 + \cdots + a_{mn}x_n = b_m


"Linear" means no products of unknowns, no powers higher than 11, and no transcendental functions of unknowns. The expression 3x12x2+x3=73x_1 - 2x_2 + x_3 = 7 is linear; the expression x1x2+x32=1x_1 x_2 + x_3^2 = 1 is not.

A solution is an assignment of values to x1,,xnx_1, \dots, x_n that satisfies every equation simultaneously. The solution set is the collection of all solutions. The central question is: what does this set look like?

Writing a System in Matrix Form

The entire system can be compressed into a single matrix equation:

Ax=bA\mathbf{x} = \mathbf{b}


where AA is the m×nm \times n coefficient matrix with entry aija_{ij} in row ii, column jj; x=(x1,x2,,xn)T\mathbf{x} = (x_1, x_2, \dots, x_n)^T is the unknown vector; and b=(b1,b2,,bm)T\mathbf{b} = (b_1, b_2, \dots, b_m)^T is the right-hand side.

Each row of AA corresponds to one equation. Each column corresponds to one unknown. The matrix-vector product AxA\mathbf{x} is a linear combination of the columns of AA weighted by the entries of x\mathbf{x}:

Ax=x1a1+x2a2++xnanA\mathbf{x} = x_1 \mathbf{a}_1 + x_2 \mathbf{a}_2 + \cdots + x_n \mathbf{a}_n


Asking whether Ax=bA\mathbf{x} = \mathbf{b} has a solution is therefore equivalent to asking whether b\mathbf{b} lies in the column space of AA — whether b\mathbf{b} can be assembled from the columns using some choice of weights.

The Augmented Matrix

The augmented matrix packages the coefficient matrix and the right-hand side into a single object:

[Ab]=(a11a12a1nb1a21a22a2nb2am1am2amnbm)[A \mid \mathbf{b}] = \left(\begin{array}{cccc|c} a_{11} & a_{12} & \cdots & a_{1n} & b_1 \\ a_{21} & a_{22} & \cdots & a_{2n} & b_2 \\ \vdots & \vdots & \ddots & \vdots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} & b_m \end{array}\right)


The vertical bar separates the coefficients from the constants but is purely notational — the augmented matrix is an m×(n+1)m \times (n+1) matrix on which row operations are performed. Every row operation on [Ab][A \mid \mathbf{b}] corresponds to a legal algebraic manipulation of the equations: swapping two equations, multiplying an equation by a nonzero scalar, or adding a multiple of one equation to another. None of these changes the solution set.

The augmented matrix is the object that Gaussian elimination operates on, and comparing its rank to the rank of AA alone determines whether the system is consistent.

The Three Possible Outcomes

A linear system Ax=bA\mathbf{x} = \mathbf{b} has exactly one of three outcomes.

No solution: the system is inconsistent. The equations impose contradictory constraints — there is no x\mathbf{x} that satisfies all of them. In the augmented matrix, this manifests as a row of the form [0  0    0d][0 \; 0 \; \cdots \; 0 \mid d] with d0d \neq 0, representing the impossible equation 0=d0 = d.

Exactly one solution: the system is consistent and determined. There is a unique x\mathbf{x} satisfying all equations. This requires the coefficient matrix to have rank equal to nn (the number of unknowns), leaving no free variables.

Infinitely many solutions: the system is consistent but underdetermined. The constraints do not pin down a single point — the solution set is a line, plane, or higher-dimensional flat parametrized by free variables.

There is no fourth option. A linear system never has exactly two solutions, or ten, or any finite number greater than one. The proof is simple: if x1\mathbf{x}_1 and x2\mathbf{x}_2 are both solutions with x1x2\mathbf{x}_1 \neq \mathbf{x}_2, then x1+t(x2x1)\mathbf{x}_1 + t(\mathbf{x}_2 - \mathbf{x}_1) is a solution for every tRt \in \mathbb{R}, producing infinitely many.

Geometric Interpretation

Each equation in a linear system defines a hyperplane in Rn\mathbb{R}^n. The solution set is the intersection of all mm hyperplanes.

For two equations in two unknowns, each equation is a line in R2\mathbb{R}^2. Two distinct non-parallel lines meet at exactly one point — a unique solution. Parallel lines never meet — no solution. Coincident lines (the same line described twice) overlap entirely — infinitely many solutions.

For three equations in three unknowns, each equation is a plane in R3\mathbb{R}^3. Three planes can intersect in a point, along a line, or not at all. They can also coincide or be arranged so that each pair intersects but no point lies on all three — a triangular prism configuration that yields no solution.

In higher dimensions the geometry is harder to visualize but the classification persists. The rank of the coefficient matrix counts how many hyperplanes cut independently — each independent equation reduces the dimension of the intersection by one. If the rank is rr and the system is consistent, the solution set has dimension nrn - r.

Elementary Row Operations

The three elementary row operations are the legal moves that transform one augmented matrix into another without altering the solution set.

Swapping two rows (RiRjR_i \leftrightarrow R_j) reorders the equations. Multiplying a row by a nonzero scalar (kRiRikR_i \to R_i) rescales an equation. Adding a multiple of one row to another (Ri+cRjRiR_i + cR_j \to R_i) replaces one equation with a combination of two equations.

Each operation is reversible: a swap undoes itself, scaling by kk is reversed by scaling by 1/k1/k, and adding cc times row jj to row ii is reversed by subtracting cc times row jj from row ii. Reversibility guarantees that the solution set is unchanged — no solutions are created or destroyed.

Each row operation corresponds to left-multiplication by an elementary matrix. This algebraic interpretation connects the row-reduction algorithm to the theory of matrix factorization and invertibility. The full systematic application of row operations is Gaussian elimination.

Row Echelon Form and Reduced Row Echelon Form

Row operations aim to reduce the augmented matrix to a standard shape from which the solution can be read.

Row echelon form (REF) has a staircase pattern: the leading entry of each row is to the right of the leading entry of the row above, and all entries below each leading entry are zero. In REF, the solution is obtained by back substitution — solving from the bottom row upward.

Reduced row echelon form (RREF) goes further: each leading entry is 11 and is the only nonzero entry in its column. In RREF, the solution is visible by inspection — each pivot variable is already isolated.

The RREF of any matrix is unique. Different sequences of row operations always arrive at the same RREF. This uniqueness makes the pivot positions intrinsic to the matrix: the rank, the free variables, and the solvability verdict all follow from the pivot structure. The full treatment of both forms, including how to read solutions from each, is on the echelon form page.

Homogeneous Systems

The special case Ax=0A\mathbf{x} = \mathbf{0} — where every right-hand side entry is zero — is called a homogeneous system. It is always consistent, since x=0\mathbf{x} = \mathbf{0} satisfies every equation. The question is whether nontrivial solutions exist.

Nontrivial solutions exist if and only if the rank of AA is less than nn. If the system has more unknowns than equations (n>mn > m), nontrivial solutions are guaranteed — the rank cannot exceed mm, which is less than nn.

The solution set of a homogeneous system is the null space of AA: a subspace of Rn\mathbb{R}^n with dimension nrank(A)n - \text{rank}(A). The superposition principle holds — any linear combination of solutions is again a solution — which is why the solution set has the clean structure of a vector space rather than an arbitrary collection of points.

When Does a Solution Exist? When Is It Unique?

The rank of AA determines both existence and uniqueness of solutions to Ax=bA\mathbf{x} = \mathbf{b}.

Existence: a solution exists if and only if rank(A)=rank([Ab])\text{rank}(A) = \text{rank}([A \mid \mathbf{b}]). This means b\mathbf{b} lies in the column space of AA — appending it as an extra column does not introduce a new independent direction.

Uniqueness: if a solution exists, it is unique if and only if rank(A)=n\text{rank}(A) = n. Full column rank means no free variables and a trivial null space, so the particular solution stands alone with no homogeneous component to add freedom.

When AA is square (m=nm = n) and det(A)0\det(A) \neq 0, both conditions hold for every b\mathbf{b}: the system always has a unique solution, given by x=A1b\mathbf{x} = A^{-1}\mathbf{b}. When AA is rectangular or singular, the analysis requires comparing ranks and identifying free variables. The full treatment, including overdetermined and underdetermined systems, is on the solvability page.

Solution Methods Beyond Row Reduction

Gaussian elimination is the most general and widely used method, but several alternatives exist for special cases.

Cramer's rule solves an n×nn \times n system by expressing each unknown as a ratio of determinants. It gives a closed-form solution but is computationally impractical for large nn.

The inverse formula x=A1b\mathbf{x} = A^{-1}\mathbf{b} applies when AA is square and invertible. It is elegant but rarely the most efficient approach — computing A1A^{-1} costs roughly three times as much as solving by elimination.

LU decomposition factors AA into a lower triangular matrix LL and an upper triangular matrix UU. Once the factorization is computed, solving Ax=bA\mathbf{x} = \mathbf{b} reduces to two cheap triangular solves. This is the method of choice when multiple systems share the same coefficient matrix AA but have different right-hand sides.

Iterative methods — Jacobi, Gauss-Seidel, conjugate gradient — generate a sequence of approximations converging to the solution. They are preferred for very large sparse systems where direct methods would require too much memory or time. These methods lie at the boundary between linear algebra and numerical analysis.