While using the matrix inverse (which we'll cover next) provides a neat theoretical way to express the solution to Ax=b as x=A−1b, it's often not the most computationally efficient or numerically stable way to actually find the solution x, especially for large systems. A more fundamental and often practical algorithm for solving systems of linear equations is Gaussian elimination. You might have encountered this method before, perhaps in a different context. Here, we'll review it as a systematic procedure for manipulating matrix equations.
The core idea behind Gaussian elimination is to transform the original system of equations into an equivalent system that is much easier to solve. "Equivalent" means the new system has the same solution set as the original one. We achieve this transformation by applying a sequence of elementary row operations to an augmented matrix.
The Augmented Matrix
First, let's represent the system Ax=b using an augmented matrix. This is simply the matrix A with the vector b appended as an extra column. We often draw a vertical line to separate them visually, though this is just a convention.
Gaussian elimination proceeds by applying three types of elementary row operations to this augmented matrix:
Swapping two rows: Interchanging row i and row j. (Corresponds to swapping two equations).
Scaling a row: Multiplying all elements in row i by a non-zero scalar c. (Corresponds to multiplying an equation by c).
Adding a multiple of one row to another: Adding c times row i to row j. (Corresponds to adding a multiple of one equation to another).
Crucially, none of these operations change the underlying solution set of the linear system.
The Goal: Row Echelon Form
The objective of applying these operations is to transform the coefficient part (the left side) of the augmented matrix into an upper triangular form, also known as row echelon form. A matrix is in row echelon form if:
All rows consisting entirely of zeros are at the bottom.
The first non-zero entry (the "leading entry" or "pivot") of each non-zero row is strictly to the right of the leading entry of the row above it.
For our example augmented matrix, a possible row echelon form might look like this (the exact values depend on the operations chosen):
■00∗■0∗∗■∗∗∗
where ■ represents a non-zero pivot element and ∗ represents any value (including zero).
The Process: Forward Elimination and Back Substitution
Gaussian elimination typically involves two phases:
Forward Elimination: Systematically use the row operations to introduce zeros below the pivot in each column, moving from left to right. This achieves the row echelon form.
Back Substitution: Once the matrix is in row echelon form, the corresponding system of equations is easy to solve. The last equation gives the value of the last variable directly. This value can then be substituted back into the second-to-last equation to solve for the second-to-last variable, and so on, moving upwards.
Let's illustrate with our example:
2−3−21−11−1228−11−3
Step 1: Target zeros below the first pivot (the '2' in row 1, column 1).
Add 23 times Row 1 to Row 2: R2←R2+23R1
Add 1 times Row 1 to Row 3: R3←R3+R1
20011/22−11/21815
Step 2: Target zero below the second pivot (the '1/2' in row 2, column 2).
Add −4 times Row 2 to Row 3: R3←R3−4R2
20011/20−11/2−1811
This matrix is now in row echelon form.
Step 3: Back Substitution. Convert back to equations:
2x1+x221x2−+x321x3−x3===811
From the last equation: −x3=1⟹x3=−1.
Substitute x3=−1 into the second equation: 21x2+21(−1)=1⟹21x2−21=1⟹21x2=23⟹x2=3.
Substitute x2=3 and x3=−1 into the first equation: 2x1+(3)−(−1)=8⟹2x1+4=8⟹2x1=4⟹x1=2.
So, the solution is x=23−1.
A simplified flowchart illustrating the main stages of Gaussian elimination: transforming the augmented matrix to row echelon form via row operations (Forward Elimination), followed by Back Substitution to find the solution vector.
Relevance and Limitations
Gaussian elimination provides a concrete algorithm for solving Ax=b. Understanding this process is helpful because:
Foundation: It's the basis for many practical algorithms used in numerical linear algebra libraries, although implementations often use variations (like LU decomposition, which we'll touch upon later) for better efficiency and stability.
Concept: It reinforces the idea of transforming a problem into an equivalent, simpler form.
Analysis: It helps in understanding concepts like matrix rank and the existence/uniqueness of solutions (e.g., a row of zeros in the coefficient part but a non-zero value on the right side indicates no solution).
While performing Gaussian elimination by hand is feasible for small systems, it becomes tedious and prone to numerical errors (especially involving division by small numbers) for larger systems. In practice, we rely on optimized and robust implementations available in libraries like NumPy and SciPy, which often use more advanced techniques derived from these principles.
In the next sections, we will explore the matrix inverse and how it provides an alternative, algebraic way to think about solving Ax=b, along with how to compute it using computational tools.