Sunday, April 26, 2009

divide by zero and Gauss elimination

when applying Gauss elimination, the algorithm could be simplified if we define a divide by zero class.

given a matrix m =

2 2 0 0
0 -1 3 3
3 -2 -1 3

1) we Unitify each row by divide it's column 0 .

1 1 0 0 row 0 divide 2
0/0 -1/0 3/0 3/0 row 1 divide 1
1 -2/3 -1/3 1 row 2 divide 3

2) row 1 and row 2 minus row 0

1 1 0 0
0/0-1 -1/0-1 3/0-0 3/0-0 row 1 - row 0
0 -5/3 -1/3 1 row 2 - row 0

3) apply 0 * to row 1 .
row 1 becomes
0 -1 3 3

here we define x/0 * 0 = x , and x / 0 + y = x/0 ( because when you apply 0* to y , you get 0 )