You have 4 variables, a,b,c,d:
ax +by +cz = d
this is ax + by + cz -d = 0 which is a plane. This means the solution is something from analytic geometry (vectors).
You either need 3 equations (if d is given), or then you parametrize with t, where the number of variables minus the number of equations equals the degrees of free"doom".
Now assuming you have: 1x + 1y + 1z = 2 4x + 2y + 1z = 7 1x - 1y + 1z = -2
so you get the coefficient's matrix: x y z | d ------------------- |--------- 1 1 1 | 2 4 2 1 | 7 1 -1 1 | -2
-----------------------------
yo shall now substitute by row 2 = row 2 - (4/1) * row 1 and row 3 = row 3 - (1/1) * row 1
then row 3 = row 3 - (-1/[row2 y from last step]) * row 2
this leavs you with a triangular matrix: x y z | d ------------------- |--------- 1 1 1 | 2 0 2 3 | 1 0 0 3 | -3
-----------------------------
now you can do backward substitution: 3z = -3 --> z use the value obtained for z from row3 in row 2 --> y now use z & y from the two previous rows to solve for z in the first row.
Doing this in a computer program shouldn't be that difficult, just remember to use double and not int, because you're doing divisions... ):P
if you have one or more rows of zeros, or one line being a multiple of the other, then the system is unsolvable...
- exactly one solution for rank (koefficient matrix)= rank(extended coefficient matrix)
- infinite solutions for rank(coefficient matrix ) = rank(extended coefficient matrix)
- no solution if rank(coefficient matrix) < rank(extended coefficient matrix)
Now copy paste the rank function from somewhere from the internet... (and look at how it works)
also x[i] = det(A[i])/det(A) wikipedia, cramer's rule
now assume a parametrization: 4x + 2y + (a+2) z = a 2x + 2y + (a+1) z = 2a 5x + 4y - (a^2-a-2)z = 3a -1
now set up the extended coefficient matrix:
x y z | d ---------------------|--------- 4 2a a+2 | a 2 2a a+1 | 2a 4 4a -a^2+a+2 | 3a-1
-----------------------------
now subtract the first row (2/4) times from the second row and so forth
now this leaves: x y z | d ---------------------|--------- 4 2a a+2 | a 0 2a a | 2a 0 0 a*(a+1) | a-1
-----------------------------
so for a = -1 follows, rank(A) = rank(B) = 2 so you have infinite solutions
for a = 0 you have rank(A) = 1 and rank(B) = 2
so there exist no solutions for a = 0.
in every other case, you've got exactly one solution. Done. now check whether all solutions are in the range! implement! :lolflag: