Professional Documents
Culture Documents
8 −22 13 3
We used elementary (and “pseudo” elementary) matrices to factor A into the product of a lower-triangular
matrix with one that is upper-triangular:
−4 32 −2 −16 1.0 0 0 0 −4.0 32.0 −2.0 −16.0
4 −14 6 4 −1.0 1.0 0 0 0 18.0 4.0 −12.0
10 −29 11 −8 = −2.5 2.833
1.0 0 0 0 −5.333 −14.0
8 −22 13 3 −2.0 2.333 0.0625 1.0 0 0 0 −0.125
Solving Lz = b becomes:
1.0 0 0 0 z1 −38
−1.0 1.0 0 0 z2 86
=
−2.5 2.833 1.0 0 z3 239
−2.0 2.333 0.0625 1.0 z4 189
There are four equations represented here; for example the third equation is
−2.5z1 + 2.833z2 + 1z3 + 0z4 = 239,
which will be more useful if we rewrite it as
z1 = vecb(1)
z2 = vecb(2) - Lower(2,1)*z1
z3 = vecb(3) - Lower(3,1)*z1 - Lower(3,2)*z2
z4 = vecb(4) - Lower(4,1)*z1 - Lower(4,2)*z2 -Lower(4,3)*z3
Make absolutely SURE you know how we arrived at the four equations above, and NOTE WELL none of
them have any actual numbers ( like 239, or 86, or 2.8333, or 0.0625) in them, instead we refer to the locations
in the vector b and matrix Lower and force MATLAB to “look up” and use all those actual numbers. And
MATLAB did this and found four numeric values for the four zi ’s.
Hey! What were those four zi ’s, by the way? LOOK THEM UP!
We’re only halfway done: Now we need to solve the new matrix equation U x = z, that is,
−4.0 32.0 −2.0 −16.0 x1 z1
0 18.0 4.0 −12.0
x2 = z2
(1)
0 0 −5.333 −14.0 x3 z3
0 0 0 −0.125 x4 z4
Again, we typed the four equations thus represented into MATLAB, again avoiding any actual numbers, and
this time starting with the LAST equation and working UP the list of four equations.
But WAIT! Time ran out! We only got as far as
x4 = z4/Upper(4,4)
x3 = (z3 - Upper(3,4)*x4)/Upper(3,3)
HW12 - 01 FINISH YOUR MATLAB FILE: put the remaining two equations in place. Do this:
A) On actual PAPER, write out the four equations represented in matrix equation (1) above, from the bottom
equation to the top. (That is, in reverse order from the way the equations appear in the matrix) HINT: One of
them will be 0x1 + 18x2 + 4.0x3 − 12x4 = z2
B) Rewrite the four equations in the form x4 = · · · , x3 = · · · , etc.
C) Replace any actual numbers in those equations with their locations in the array Upper and vector z.
D) Type these equations into MATLAB; again we did this for two of the equations.
E) Then make sure your MATLAB program correctly finds the numeric values of all four of x1 , x2 , x3 and x4 .
You already know what they are because we made the solution NiceSolution to begin with!
−306
136
HW12-2: Solve the same system, in the same way, for b now set to 120 . NOTE WELL we discussed
204
that this involves very little extra work, having already done the problem once for the original b.
14
29
HW 12-3: Do it ONE MORE TIME but this time with b = 88 . These four numbers are more-or-less
20
random: I took the last four robo-calls off my home-phone, and used the last two digits from each of them! The
point here is to see how messy a solution might be...
HW 12-4: Find the solutions to the three problems in HW12 - 1, HW12 - 02 and HW12 - 03 using the rref
function in MATLAB. For a given b, you should know how to enter the augmented matrix [A|b] into MATLAB;
then just “rref” it!
NOTE WELL: a pseudo-elementary matrix is the product of two or more elementary matrices that represent
the row operations rk ← rk + Crm where the changed row rk can vary, but the same row rm is used to modify
the other rows rk in each row operation and the C’s are constants. If you just use multiples of ONE row to
modify the others, then the order in which you make the changes doesn’t matter, and they can all be done at
once by this product.