# Improve Upper Triangular Matrix Computation for Gauss Jordan method?

I am solving Simultaneous Equations using the Gauss Jordan method. I am having a problem in computing the Upper triangular Matrix with sufficient accuracy for no of variables >50. Some of the elements in the lower triangular region are not exactly becoming zero (some are ~ 1e-14). Hence the solution I am getting is a bit inaccurate. So I wanted to know whether there is any method by which I can improve the accuracy of my Upper Triangular Matrix?

Example (Please consider the following case for 3 variables just a scaled down example of what I am getting for 50 variables):

This is the original co-efficient matrix:
1  2  3
3  2  1
2  3  1

This is ideally the reduced upper triangular matrix:
1   2   3
0  -4  -8
0   0  -3

This is what I am currently getting:
1      2      3
0.1   -4.1   -7.9
0.01  -0.09  -3.2

How do I improve the above matrix to something like the below matrix:
1         2        3
0.0001   -4.0001  -7.9995
0.00005  -0.005   -3.0001


I know that it is not possible to obtain the exact upper triangular matrix, but how can I improve my current matrix so that the error becomes small? Please let me know if I could not explain the question properly. Thank You.

• Do you do pivoting? Without it Gauss-Jordan method is generally unstable. – Ruslan Apr 29 '13 at 10:31
• Hi Ruslan, Thank You for asnwering. I am not a Mathematician by profession, though I like Mathematics. I could not understand what you meant by pivoting. May be I know what it is but I dont know the terminology. So can you please tell me in some detail about what pivoting is? Thank You. – Cool_Coder Apr 29 '13 at 10:34
• See this page: en.wikipedia.org/wiki/Pivot_element – Ruslan Apr 29 '13 at 10:59
• Thanks a lot! Some of the techniques mentioned I have already implemented. Some I will implement at the earliest. But these techniques are applicable before the reduction operation. So what should I do to improve the accuracy of already reduced matrix as shown in my question? – Cool_Coder Apr 29 '13 at 11:23