June 29, 2005

Cramer's Rule #%!!&*%$@&

June 29, 2005 Posted by Vijay , 3 comments
Happened to come across the Cramer's rule, which used to be a part of the Engineering Syllabus in one of yahoogroup's postings, ascent4cat. It was regarding solving a set of linear equations for unknown variables x,y and z using Cramer's method. Here we go ... as to how to solve %$^$^@#*

-------------------------------------------------------------------------------------


In Cramer's method we form the main determinant from the coefficients of the variables. We then make a new determinant for each unknown in the system by replacing that variable's column by the system's constants. The value of the specific unknown is determined by dividing the special determinant by the main determinant.

X + Y + Z = 13
X + 2Y + 4Z = 36
X + 3Y + 9Z = 79

From this we will build four determinants:

(Formed with the co-efficients of each of the variables x,y,z as each of the 3 columns
in a matrix form as below)
| 1 1 1|
main = | 1 2 4|
| 1 3 9|

Form det(X) by replacing the X column in the main determinant with the value of each linear
equation above. Similarly form the determinants for Y and Z as well.

| 13 1 1| | 1 13 1| | 1 1 13|
det(X)= | 36 2 4| det(Y) = | 1 36 4| det(Z) = | 1 2 36|
| 79 3 9| | 1 79 9| | 1 3 79|


For arriving at the value of each determinant, follow the following formula considering
a matrix form ,


| x1 y1 z1|
form = | x2 y2 z2|
| x3 y3 z3|

The delta value is calculated using the formula,

x1*((y2*z3) - (y3*z2)) + -1*y1((x2*z3) - (x3*z2)) + z1*((x2*y3) - (x3*y2))

i.e., leave out the rows which have x1/y1/z1 common in them, and then, multiply
the diagonally opposite values remaining, and subtract the products thus arrived at.

So, here, main determinant has a value,

delta = 1(18-12) -1(9-4) +1(3-2) = 6-5+1 = 2
det(X) = 13(18-12) - 1(36*9 - 79*4) +1(36*3 - 79*2) = 20
det(Y) = 1(36*9 - 79*4) - 13(9-4) + 1(79-36) = -4
det(Z) = 1(158-108) -1(79-36) +13(3-2) = 10

Also,

X = det(x)/main => 20/2 = 10
Y = det(Y)/main => -4/2 = -2
Z = det(Z)/main => 10/2 = 5

which are the desired answers

3 comments:

Vijay said...

woww some alignment problems guys :( am sorry .. adjust maadi :D

Aslan said...

hehe... typical of u. ;) do u do ur work also like this?!

Anonymous said...

Cramer's rule is annoying, that is why I rather prefer to do a online calculator to solve it, haha