jueves, 5 de diciembre de 2013

Cramer's Rule

Given a system of linear equations, Cramer's Rule is a handy way to solve for just one of the variables without having to solve the whole system of equations. They don't usually teach Cramer's Rule this way, but this is supposed to be the point of the Rule: instead of solving the entire system of equations, you can use Cramer's to solve for just one single variable.
Let's use the following system of equations:
    2x +   y + z = 3
      
    x –   yz = 0

      
    x + 2y + z = 0
We have the left-hand side of the system with the variables (the "coefficient matrix") and the right-hand side with the answer values. Let D be the determinant of the coefficient matrix of the above system, and let Dx be the determinant formed by replacing the x-column values with the answer-column values:
system of
equations
coefficient
matrix's
determinant
answer
column
Dx: coefficient determinant
with answer-column
values in
x-column
2x + 1y + 1z = 3
 
1x1y1z = 0
1x + 2y + 1z = 0
D = || 2 1 1 || 1 –1 –1 || 1 2 1 ||
[[ 3 ][ 0 ][ 0 ]]
D_x = || 3 1 1 || 0 –1 –1 || 0 2 1 ||
Similarly, Dy and Dz would then be:   Copyright © Elizabeth Stapel 2004-2011 All Rights Reserved
    D_y = || 2 3 1 || 1 0 -1 || 1 0 1 ||
    D_z = || 2 1 3 || 1 -1 0 || 1 2 0 ||
Evaluating each determinant, we get:
    D = 3
    D_x = 3
    D_y = -6
    D_z = 9
Cramer's Rule says that x = Dx ÷ D, y = Dy ÷ D, and z = Dz ÷ D. That is:
    x = 3/3 = 1,  y = –6/3 = –2,  and  z = 9/3 = 3
That's all there is to Cramer's Rule. To find whichever variable you want (call it "ß" or "beta"), just evaluate the determinant quotient Dß ÷ D. (Please don't ask me to explain why this works. Just trust me that determinants can work many kinds of magic.)
  • Given the following system of equations, find the value of z.
    • 2x +   y +   z = 1
        
      x –   y + 4z = 0

        
      x + 2y – 2z = 3
    To solve only for z, I first find the coefficient determinant.
      D = -3
    Then I form Dz by replacing the third column of values with the answer column:
      D_z = -6
        
    Then I form the quotient and simplify:

    D_z / D = -6 / -3 = 2
      z = 2
The point of Cramer's Rule is that you don't have to solve the whole system to get the one value you need. This saved me a fair amount of time on some physics tests. I forget what we were working on (something with wires and currents, I think), but Cramer's Rule was so much faster than any other solution method (and God knows I needed the extra time). Don't let all the subscripts and stuff confuse you; the Rule is really pretty simple. You just pick the variable you want to solve for, replace that variable's column of values in the coefficient determinant with the answer-column's values, evaluate that determinant, and divide by the coefficient determinant. That's all there is to it.
Almost.
What if the coefficient determinant is zero? You can't divide by zero, so what does this mean? I can't go into the technicalities here, but "D = 0" means that the system of equations has no unique solution. The system may be inconsistent (no solution at all) or dependent (an infinite solution, which may be expressed as a parametric solution such as "(a, a + 3, a – 4)"). In terms of Cramer's Rule, "D = 0" means that you'll have to use some other method (such as matrix row operations) to solve the system. If D = 0, you can't use Cramer's Rule.

lunes, 2 de diciembre de 2013

Determinants

Determinants: 2×2 Determinants

Determinants are like matrices, but done up in absolute-value bars instead of square brackets. There is a lot that you can do with (and learn from) determinants, but you'll need to wait for an advanced course to learn about them. In this lesson, I'll just show you how to compute 2×2 and 3×3 determinants. (It is possible to compute larger determinants, but the process is much more complicated.)
If you have a square matrix, its determinant is written by taking the same grid of numbers and putting them inside absolute-value bars instead of square brackets:
    If this is "the matrix A" (or "A")...
    ...then this is "the determinant
    of
    A" (or "det A").
     
    [[ 1 0 3 ][ 6 -2 1 ][ 0 3 0 ]]
      
     
    || 1 0 3 || 6 -2 1 || 0 3 0 ||
      
Just as absolute values can be evaluated and simplified to get a single number, so can determinants. The process for evaluating determinants is pretty messy, so let's start simple, with the 2×2 case.

For a 2×2 matrix, its determinant is found by subtracting the products of its diagonals, which is a fancy way of saying in words what the following says in pictures:
the matrix A
the determinant of A ("det A")
[[ a b ][ c d ]]
animation: det(A) = ab - cb
the matrix A
the determinant of A ("det A")
[[ 1 2 ][ 3 4 ]]
animation: det(A) = (1)(4) - (3)(2) = 4 - 6 = -2
In other words, to take the determinant of a 2×2 matrix, you multiply the top-left-to-bottom-right diagonal, and from this you subtract the product of bottom-left-to-top-right diagonal.
"But wait!" I hear you cry; "Aren't absolute values always supposed to be positive? You show that second matrix above as having a negative determinant. What's up with that?" You make a good point. Determinants are similar to absolute values, and use the same notation, but they are not identical, and one of the differences is that determinants can indeed be negative.
  • Evaluate the following determinant:
    • || 1 -4 || 0 3 ||
    I multiply the diagonals, and subtract:   Copyright © Elizabeth Stapel 2004-2011 All Rights Reserved
      (1)(3) - (0)(-4) = 3 - 0 = 3
  • Find the determinant of the following matrix:
    • [[ 2 1 ][ -1 3 ]]
I convert from a matrix to a determinant, multiply along the diagonals, subtract, and simplify:


Determinants: 3×3 Determinants (page 2 of 2)
Sections: 2×2 determinants, 3×3 determinants

The computations for 3×3 determinants are messier than for 2×2's. Various methods can be used, but the simplest is probably the following:   Copyright © Elizabeth Stapel 2004-2011 All Rights Reserved

    Take a matrix
    A:

    [[ 1 2 3 ][ 0 -4 1 ][ 0 3 -1]]
     

    Write down its determinant:


    || 1 2 3 || 0 -4 1 || 0 3 -1 ||
     

    Extend the determinant's grid by rewriting the first two columns of numbers:


    ( 1 2 3 1 2 )( 0 -4 1 0 -4 )( 0 3 -1 0 3 )
      

    Then multiply along the down-diagonals:


    multiplying down
     

    ...and along the up-diagonals

    multiplying up
     

    Add the down-diagonals and subtract the up-diagonals:

    det(A) = (4) + (0) + (0) - (0) - (3) - (0)
     

    And simplify:


    det(A) = (4) + (0) + (0) - (0) - (3) - (0) = 4 - 3 = 1
      Then det(A) = 1.
  • Find the deteriminant of the following matrix:
    • [[ 5 –2 1 ][ 0 3 –1 ][ 2 0 7 ]]
        
    First I convert from the matrix to its determinant, with the extra columns:

    ( 5 –2 1 5 –2 )( 0 3 –1 0 3 )( 2 0 7 2 0 )
      

    Then I multiply down and up the diagonals:

    multiplications along the diagonals
     
    Then I add the down-diagonals, subtract the up-diagonals, and simplify for the final answer:
      || 5 –2 1 || 0 3 –1 || 2 0 7 || = (105) + (4) + (0) – (6) – (0) – (0) = 109 – 6 = 103
There are other methods for simplifying determinants by hand, and these other methods are required when evaluating larger determinants by hand, but those methods can probably wait until later. For the time being, note that your graphing calculator should be able to evaluate the determinant of any (square) matrix you enter. For instance:
    [C] = [[ 5 –2 1 ][ 0 3 –1 ][ 2 0 7 ]] then det([C]) = 103
But make sure, even if you have a graphing calculator, that you can evaluate 2×2 and 3×3 determinants, because you are likely to have word problems where the determinants contain variables that your calculator can't handle.(6) - (-1) = 6 + 1 = 7

Solving Systems of Linear Equations Using Matrices

If you need to, review matrices, matrix row operations and solving systems of linear equations before reading this page.
The matrix method of solving systems of linear equations is just the elimination method in disguise. By using matrices, the notation becomes a little easier.
Suppose you have a system of linear equations such as:

The first step is to convert this into a matrix. Make sure all equations are in standard form (Ax + By = C), and use the coefficients of each equation to form each row of the matrix. It may help you to separate the right column with a dotted line.

Next, we use the matrix row operations to change the 2 × 2 matrix on the left side to the identity matrix. First, we want to get a zero in Row 1, Column 2. So, add 4 times Row 2 to Row 1.

Next we want a 1 in the top left corner.

Now we want a zero in the bottom left corner.

Finally, we want a 1 in Row 2, Column 2.

Now that we have the 2 × 2 identity matrix on the left, we can read off the solutions from the right column:
x = 3
y = –1
The same method can be used for n linear equations in n unknowns; in this case you would create an n × (n + 1) matrix, and use the matrix row operations to get the identity n × n matrix on the left side.
Important Note: If the equations represented by your original matrix represent parallel lines, you will not be able to get the identity matrix using the row operations. In this case, the solution either does not exist or there are infinitely many solutions to the system.