Among the least fond memories of high school algebra are the lessons on solving systems of linear equations, with the drudgery of the repetitious hand calculations. This must be one of the algorithms we would most want to implement on a computer.
In this chapter, we'll first review the algorithm behind the hand calculations, and then we'll make some improvements to this algorithm. Finally, we'll implement this algorithm as a Java class that uses matrices.
Let's start with the following example of a system of four linear equations in four unknowns x1, x2, x3, and x4:
The correct solution is x1 = 1, x2 = −2, x3 = 3, and x4 = −1.
The first set of operations is called