A system of m linear equations in n unknowns can be written as Ax=bWhere A∈Mm×n(R), x∈RnAnd b∈Rm.
Gaussian elimination transforms the augmented matrix [A∣b] into row echelon Form (REF) using elementary row operations:
Swap two rows (Ri↔Rj).
Multiply a row by a non-zero scalar (Ri→αRi).
Add a multiple of one row to another (Ri→Ri+αRj).
A matrix is in REF if:
All zero rows are at the bottom.
The leading entry (pivot) of each non-zero row is strictly to the right of the pivot above.
All entries below a pivot are zero.
Reduced row echelon form (RREF) additionally requires:
Each pivot is 1.
Each pivot is the only non-zero entry in its column.
Theorem 4.1. Every matrix has a unique RREF. Two matrices are row-equivalent if and only if they Have the same RREF.
4.2 Existence and Uniqueness
Theorem 4.2 (Rouché—Capelli). The system Ax=b is consistent (has at least one Solution) if and only if
rank(A)=rank([A∣b])
If consistent, the solution set has dim(null(A)) free parameters, where dim(null(A))=n−rank(A).
Proof. Let the RREF of [A∣b] have r=rank(A) pivots in the coefficient Columns. The system is inconsistent if and only if the last non-zero row is [0⋯0∣1] Which occurs precisely when the augmented column contains a pivot, i.e., when rank([A∣b])>r.
If consistent, the r pivot variables are determined by the n−r free variables, yielding n−rank(A) degrees of freedom. ■
4.3 LU Decomposition
An LU decomposition of A∈Mn×n(R) writes A=LU where L is Lower triangular with 1s on the diagonal, and U is upper triangular.
Theorem 4.3. If Gaussian elimination can be performed on A without row exchanges, then A Admits an LU decomposition.
Algorithm. Store the multipliers mij (used to eliminate entry aij) in the lower Triangular portion. The resulting upper triangular matrix is UAnd the multipliers form L.
To solve Ax=bFirst solve Ly=b (forward substitution), Then Ux=y (back substitution).
4.4 Gaussian Elimination with Partial Pivoting
When a pivot is zero (or very small), we swap rows to bring the largest available entry in the Current column into the pivot position. This is partial pivoting, and it improves numerical Stability.
Problem. Solve the system using Gaussian elimination with partial pivoting:
x1+2x2+x33x1+x2−x32x1+3x2+4x3=5=2=11
Solution
Augmented matrix:
[A∣b]=1322131−145211
Step 1. Column 1: largest entry is 3 in row 2. Swap R1↔R2:
312123−1142511
R2→R2−31R1, R3→R3−32R1:
30015/37/3−14/314/3213/329/3
Step 2. Column 2: largest entry below pivot is 7/3 in row 3. Swap R2↔R3:
30017/35/3−114/34/3229/313/3
R3→R3−75R2:
30017/30−114/3−2/7229/3−6/7
Back substitution. From row 3: −72x3=−76So x3=3.
From row 2: 37x2+314(3)=329So 37x2=329−14=−313 Giving x2=−713.
From row 1: 3x1+(−713)−3=2So 3x1=2+3+713=748 Giving x1=716.
Solution:x1=716, x2=−713, x3=3. ■
4.5 Least Squares Solutions
When Ax=b is overdetermined (more equations than unknowns) and inconsistent, We seek x that minimises ∥Ax−b∥2.
Theorem 4.4 (Normal Equations). The least squares solution x^ satisfies
ATAx^=ATb
If A has full column rank, then ATA is invertible and x^=(ATA)−1ATb.
Proof. The error vector e=Ax−b is minimised when e⊥col(A) I.e., when ATe=0. This gives AT(Ax−b)=0 Or ATAx=ATb. If A has full column rank, then ker(A)={0} So ker(ATA)=ker(A)={0}Meaning ATA is invertible. ■
Problem. Find the least squares line y=ax+b fitting the data points (1,1), (2,1), (3,3).
Solution
The system is 123111(ab)=113 I.e., Ax=b with A=123111x=(a,b)T, b=(1,1,3)T.
Now the system is consistent. Pivots in columns 1 and 3; free variables are x2 and x4. From row 2: x3=x4. From row 1: x1=1−2x2+x3−3x4=1−2x2−2x4.
Solution set: {(1−2s−2t,s,t,t):s,t∈R}.
In parametric form: x1x2x3x4=1000+s−2100+t−2011.
The solution space is a 2-dimensional affine subspace (a plane) in R4. ■
4.7 Common Pitfalls
Partial pivoting is not optional for numerical work. Without it, Gaussian elimination can produce catastrophically wrong results due to rounding errors.
The normal equations can be ill-conditioned. For better numerical stability, use QR decomposition to solve least squares problems instead of forming ATA.
Not every system has a solution. Always check consistency via the Rouché—Capelli theorem before attempting to solve.