Elimination_Graphically.mw

 

Elementary Linear Algebra by Larson, Edwards, and Falvo (5th Edition) 

Problem #79 in Section 1.1 

 

Solve   x - 4y = -3 using Gaussian elimination, then graph the lines obtained during each step. 

        5x - 6y = 13 

 

> # Clear memory and include the "plots" package.

restart;
with(plots):
 

> # Define the equations "line1" and "line2"
# These are implicitly defined equations,
# so we must use "implicitplot".
# The "display" command will display both
# plots simultaneously. We temporarily
# suppress the output by using ":" instead of ";".

line1 :=   x -4*y = -3;
line2 := 5*x -6*y = 13;
plot1 := implicitplot(line1,x=-1..7,y=-1..7):
plot2 := implicitplot(line2,x=-1..7,y=-1..7,color=blue):
step0 := display(plot1,plot2):
 

 

`+`(x, `-`(`*`(4, `*`(y)))) = -3
`+`(`*`(5, `*`(x)), `-`(`*`(6, `*`(y)))) = 13 (1)
 

> line1 := x -4*y = -3;
line2 :=   14*y = 28;
plot1 := implicitplot(line1,x=-1..7,y=-1..7):
plot2 := implicitplot(line2,x=-1..7,y=-1..7,color=blue):
step1 := display(plot1,plot2):
 

 

`+`(x, `-`(`*`(4, `*`(y)))) = -3
`+`(`*`(14, `*`(y))) = 28 (2)
 

> line1 := x -4*y = -3;
line2 :=      y =  2;
plot1 := implicitplot(line1,x=-1..7,y=-1..7):
plot2 := implicitplot(line2,x=-1..7,y=-1..7,color=blue):
step2 := display(plot1,plot2):
 

 

`+`(x, `-`(`*`(4, `*`(y)))) = -3
y = 2 (3)
 

> line1 := x    = 5;
line2 :=    y = 2;
plot1 := implicitplot(line1,x=-1..7,y=-1..7):
plot2 := implicitplot(line2,x=-1..7,y=-1..7,color=blue):
step3 := display(plot1,plot2):
 

 

x = 5
y = 2 (4)
 

> display(step0);
display(step1);
display(step2);
display(step3);
 

 

 

 

Plot_2d
Plot_2d
Plot_2d
Plot_2d
 

> # Click on the picture below and use the
# "animation toolbar" above to play the
# animation (You may want to slow the
# "frames per second" down from 10 to 1).

display([step0,step1,step2,step3], insequence = true);
 

Plot_2d