System of Linear Equations Calculator
Solve a system of linear equations represented in matrix form as Ax = b. Depending on the coefficient matrix and the right-hand side, a system may have a unique solution, infinitely many solutions, or no solution.
A
b
Learn About System of Linear Equations
A system of $m$ linear equations in $n$ unknowns is written in matrix notation as:
where $\mathbf{A} \in \mathbb{R}^{m \times n}$ is the coefficient matrix, $\mathbf{x} \in \mathbb{R}^n$ contains the unknowns, and $\mathbf{b} \in \mathbb{R}^m$ contains the constants.
The Augmented Matrix and Gauss-Jordan Elimination
GammaCalculator constructs the augmented matrix $[\mathbf{A} \mid \mathbf{b}]$ and reduces it to Reduced Row Echelon Form (RREF) using exact rational arithmetic (`Fraction`):
The Rouché-Capelli Classification
The existence and structure of solutions are governed by comparing the rank of $\mathbf{A}$ with the rank of the augmented matrix $[\mathbf{A} \mid \mathbf{b}]$:
- Inconsistent System (No Solution):
Row reduction yields a contradiction row $\begin{bmatrix} 0 & \cdots & 0 & \mid & d \end{bmatrix}$ with $d \ne 0$ ($0 = d$). Geometrically, $\mathbf{b}$ lies outside the column space of $\mathbf{A}$.
- Unique Solution:
Every column of $\mathbf{A}$ contains a leading pivot $1$. The unique solution vector is read directly from the augmented column: $\mathbf{x} = \mathbf{c}$.
- Infinitely Many Solutions (Underdetermined):
The system has $k = n - r$ free variables. The general solution is expressed parametrically:
where $\mathbf{x}_p$ is a particular solution and $\{\mathbf{v}_1, \dots, \mathbf{v}_k\}$ spans $\operatorname{Null}(\mathbf{A})$.
Worked Numerical Example
Solve the $3 \times 3$ system:
- Augmented Matrix:
- Forward Elimination:
- $R_2 \leftarrow R_2 - 2R_1 \implies [0, 1, 1 \mid 3]$
- $R_3 \leftarrow R_3 - R_1 \implies [0, -1, 1 \mid -1]$
- $R_3 \leftarrow R_3 + R_2 \implies [0, 0, 2 \mid 2] \implies R_3 \leftarrow \frac{1}{2}R_3 = [0, 0, 1 \mid 1]$
- Backward Elimination to RREF:
- $R_2 \leftarrow R_2 - R_3 \implies [0, 1, 0 \mid 2]$
- $R_1 \leftarrow R_1 - R_3 \implies [1, 2, 0 \mid 7]$
- $R_1 \leftarrow R_1 - 2R_2 \implies [1, 0, 0 \mid 3]$
- Result:
Because $\operatorname{rank}(\mathbf{A}) = \operatorname{rank}([\mathbf{A} \mid \mathbf{b}]) = n = 3$, the system has a unique solution:
Can a linear system ever have exactly two solutions?
No. Over the real numbers, a linear system has either zero, one, or infinitely many solutions. If two distinct solutions $\mathbf{x}_1$ and $\mathbf{x}_2$ exist, any combination $\alpha \mathbf{x}_1 + (1-\alpha)\mathbf{x}_2$ is also a solution for any scalar $\alpha \in \mathbb{R}$, generating infinitely many solutions.
Why is Gauss-Jordan elimination preferred over Cramer's rule?
For an $n \times n$ system, Cramer's rule evaluates $n + 1$ determinants, costing $O((n+1)!)$ operations. Gauss-Jordan elimination solves the system in $O(n^3)$ operations, running orders of magnitude faster.
What is the geometric interpretation of a $3 \times 3$ system?
Each equation in three variables represents a 2D plane in $\mathbb{R}^3$. A unique solution is the single intersection point of three planes. Infinitely many solutions correspond to planes meeting along a common line or plane. An inconsistent system represents planes with no common intersection (e.g., parallel planes or a triangular prism).
How does an underdetermined system differ from an overdetermined system?
An underdetermined system ($m < n$) cannot have a unique solution (it is either inconsistent or has infinitely many solutions). An overdetermined system ($m > n$) has more equations than variables and typically has no exact solution unless redundant equations are linearly dependent.
- Rouché-Fontené Theorem: In European literature, the Rouché-Capelli theorem is often called the Rouché-Fontené theorem, honoring Eugène Rouché and Georges Fontené, who independently formulated rank conditions for linear solvability in the 1870s alongside Alfredo Capelli.
- Ill-Conditioned Systems: A system $\mathbf{A}\mathbf{x} = \mathbf{b}$ can possess a theoretical unique solution while being practically insolvable in floating-point arithmetic. When the condition number $\kappa(\mathbf{A}) = \|\mathbf{A}\| \, \|\mathbf{A}^{-1}\|$ is very large, tiny perturbations in $\mathbf{b}$ trigger massive deviations in the calculated solution $\mathbf{x}$.