1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Cramer's method for linear equations

  1. Jan 29, 2013 #1
    1. The problem statement, all variables and given/known data
    2x +5y -z = 3
    3x + 5y -4z = -6 the bracket needs to go infront, so x,y,z satisfy all the equations at once.
    4x -2y +6z = 1

    2. Relevant equations
    Cramer's method:
    (I don't know how to add certain symbols to the text so it is difficult to express it)
    If A were the matrix of the coefficients of the variables then aij is a corresponding element and Aij = (-1)i+j * Mij - the subdeterminant? Is it the correct word? Mij is a minor of the corresponding element.

    So Cramer's idea is this:
    |A| = a11 * A11 + a21 * A21 + a31 * A31
    a12 * A11 + a22 * A21 + a32 * A31 = 0
    a13 * A11 + a23 * A21 + a33 * A31 = 0

    3. The attempt at a solution
    I have no problem to solve this system, but the problem is:
    I get the correct determinant value , but the following equations (which need to be 0) are not zero. Is Cramer's idea flawed? I am certain I have done the calculations correctly.

    |A| = 2 * 38 - 3*28 - 4*15 = -68 good
    5*38 - 5*28 + 2*15 =/= 0 not good
    -38 + 4*28 - 6*15 =/= 0 definitely not good

    I can also skip to the part where I replace the x,y,z coefficients with the numbers on the right side of the equal sign when I solve for x,y,z , but I am not so much interested in the solution, am I even allowed to do that operation when the requirements are not met?

    I can also say for certain that there is a solution to it, because |A| =/= 0.
    Last edited: Jan 29, 2013
  2. jcsd
  3. Jan 29, 2013 #2
    Well, for starters the determinant of your matrix is -100, not -68. Recheck your calculations, you've made a number of arithmetic errors. Also I'm not clear on what "the following equations (which need to be 0) are not zero" has to do with Cramer's rule. Where does Cramer's rule say those equations need to equal zero? The only requirement for the rule to work is the matrix have a non zero determinant.
  4. Jan 29, 2013 #3
    Uhm I calculated and re calculated and recalculated this determinant a zillion times and I always got -68 , but now I got -100 :D
    Right, so I messed up big time with that - to answer your question, though - Where does it say the other 2 equations need to be 0.

    It doesn't say it directly, but it can be deduced -
    What you have during the calculations is
    |A|*x + 0y + 0z = s1 * A11 + s2 * A21 + s3 * A31 , where s ij is the vector of the solutions (3, -6, 1)
    so if X, Y, Z were the matrices where the X, Y, Z columns have been replaced by the vector s then x = X/|A| and it won't work if the other mentioned equations aren't zero.

    The part where I got confused is when I recalculated the thing a million times and didn't get the correct result and I got paranoid. So Cramer is right and I am drinking to my own stupidity tonight. I am sorry :(

    Actually, hold up on that drink. When calculate the determinant with the Sarrus rule I do get -100. 60-80+6+20-16-90 = -100, BUT...
    this a11 * A11 + a21 * A21 + a31 * A31 = -68 whereas it should be |A| = -100.
    Am I calculating the subdeterminants correctly?
    A11 = 5*6 + 2*4 = 38
    A21 = -(5*6 - 2*1) = -28
    A31 = 5*(-4) + 5*1 = -15
    so by that |A| is 38*2 - 3*28 - 4*15 = -68

    The rule by which I assume this to be correct is
    nƩk=1 ak,i*Ak,j = |A| * δi,j where δ is the Kronecker's symbol, if i = j then δ = 1, when i =/= j, then δ = 0.

    I am going berserk ...:/
    Last edited: Jan 29, 2013
  5. Jan 29, 2013 #4
    I'm sorry, but I really don't understand what you're talking about. For starters, it will really help if you learn how to use this forum's LaTeX typesetting because your notation is pretty impenetrable.

    In any case, there are no further conditions for Cramer's rule. All you do is compute the determinant, and then the determinants obtained by substituting each column with the desired solution. That's it. If you deduce any further "conditions" then they will be automatically satisfied for det(A) non-zero. I'm not sure what you're trying to do, but you are significantly over complicating this.
  6. Jan 29, 2013 #5
    Using Sarrus rule to calculate the determinants
    |A| = -100
    Ax = 219
    Ay = -175
    Az = -227
    so by Cramer's rule:
    x = 219/-100 = -2.19
    y = -175/-100 = 1.75
    z = -227/-100 = 2.27

    Check 2x + 5y -z = 3?? => -2*2.19 + 5*1.75 - 2.27 = 2.1 ...not even close

    However when I solve this system using the...invert matrix? A-1 * A * X = A-1 * S and using the determinant value of -68 when calculating A-1 elements from the...adjA. Adjugant matrix? Adjugate? :/ anyway, with the determinant value of -100 I end up in a brickwall, with -68 however, I get what I need. The reason why I am going berserk is what do I ultimately believe then?

    I am not Trying to over complicate things, but the conditions I am talking about for Cramer's rule DO have to hold true. Otherwise such substitution is not allowed and that's why I am not getting the correct answers, because I have broken the rules if I just subsitute to the determinant in the manner as you described.
    Last edited: Jan 29, 2013
  7. Jan 29, 2013 #6
    ##|A_y| = -193##, which gives y=1.93. With this correct value, x,y and z do indeed satisfy the system of equations. You should practice calculating determinants since that is where your problem seems to lie.
  8. Jan 29, 2013 #7
    I am digging my own grave already ...I am sorry, I don't know what's wrong with me today :/
  9. Jan 29, 2013 #8

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    Did somebody tell you that you must use Cramer's Rule? If not you should avoid it: it is just about the worst way to solve linear equations!

    As I said, unless you are compelled to use Cramer, just use simple elimination methods: the first equation gives you z = 2x + 5y - 3. Substituting that into the other two equations gives you two new equations in the two variables x and y. Do the same type of thing again: use one of the equations to solve for one of the variables in terms of the other; for example, you can use the first of the two new equations to solve for y in terms of x. Substituting that expression in to the other of the two new equations gives a single equation in the single variable x, which is easy to solve. Then substitute that x into the y-equation, etc.

    If you are going to solve a single 3×3 linear system just once, this method is about as good as any; if you plan to solve a lot of 3×3 (or larger) systems manually, it is worth learning such methods as row reduction, etc.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook