Sunday, February 20, 2011

Solving System of Equations using Gauss Elimination Method (Part 3)

From post [Solving System of Equations using Gauss Elimination Method (Part 2)], we know the procedures of Gauss Elimination method to solve system of linear equations. But if we write excel VBA program based on those procedures, we may encounter with problems and cannot get the calculation result. You can find more details regarding problems and how to correct them from [Numerical methods in engineering]. We will explain one problem that may occur. It's division by zero.

For example, we want to solve a set of simultaneous equations as follows using Gauss Elimination method.

The first step of Gauss Elimination method is to divide equation (1) with a coefficient of x1 which is 5. This is fine to do that. But imagine if the equation (3) and (1) are swapped as follows, we will encounter with "division by zero" problem.

Actually we will have problem if the value in diagonal term of matrix [A] is zero or has very small value. So we can avoid this problem by swapping equations to get the highest absolute value of coefficient of x in diagonal term.

In the next post, let's have a look the excel program to solve system of equations using Gauss Elimination method.

No comments: