What is a good way to implement Gaussian elimination when the operators are custom operators, rather then standard arithmetic ones?
Here are the operators:
Addition:
0 + 0 = 0
0 + 1 = 1
1 + 1 = 0
Subtraction:
0 - 0 = 0
0 - 1 = 1
1 - 1 = 0
Multiplication:
0 * 0 = 0
0 * 1 = 0
1 * 1 = 1
Division:
0 / 0 = illegal
0 / 1 = 0
1 / 1 = 1
Here is a sample set of equations as augmented matrix, with the RHS in the right-most column:
1, 1, 0, 1, 0, 0, 0, 0, 0, 1
0, 1, 0, 1, 1, 0, 0, 0, 0, 1
0, 1, 1, 0, 0, 1, 0, 0, 0, 1
1, 0, 0, 1, 0, 0, 0, 0, 0, 1
0, 1, 0, 1, 1, 0, 0, 0, 0, 1
0, 0, 0, 0, 0, 1, 0, 0, 0, 1
0, 0, 0, 1, 0, 0, 1, 0, 0, 1
0, 0, 0, 1, 1, 0, 1, 1, 0, 1
0, 0, 0, 0, 0, 1, 0, 0, 1, 1
The solution for this set is:
x1 = 1
x2 = 0
x3 = 0
x4 = 0
x5 = 1
x6 = 1
x7 = 1
x8 = 1
x9 = 0
Gaussian elimination failed for me as I tried it on this set.
The equations will have 9, 16, 25 or 36 terms. It would be great if the algorithm is easily extendable to larger squares, up to 100. I'm looking for an algorithm, in pseudo code or JavaScript preferably.