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 *x*_{1}, *x*_{2}, *x*_{3}, and *x*_{4}:

The correct solution is *x*_{1} = 1, *x*_{2} = −2, *x*_{3} = 3, and *x*_{4} = −1.

The first set of operations is called

Start Free Trial

No credit card required