Maple & Linear Systems Maple’s solve command is a general purpose equation solver. It takes a set of one or more equations and tries to solve it exactly for all the unknowns involved. (Recall that the solve command has been used previously to find roots of quadratic functions.) Solving a single equation: >solve( 1+x = 3-5*x ); 1/3 >solve( x^2 = 4 ); 2,-2 >solve( x+y = 4 ); {x = -y+4, y = y} Solving a system or set of equations: >solve( {x+y = 4, x-y = 2} ); {y = 1, x = 3} >solve( {x+y = 4, -2*x-2*y = -8} ); {x = -y+4, y = y} >solve( {x+y = 4, x+y = 3} ); Maple is returning different ‘types’ of solutions depending on the set of equations it has been asked to solve. In order to illustrate what is happening, it is possible to draw pictures using the plot command. When plotting in two-dimensions, y is written in terms of x (i.e. y=f(x)), then Maple is asked to plot this function of x over a specified domain (i.e. an interval of x values). For instance, suppose the line x+y = 4 is to be plotted: y is first written in terms of x, that is, y = 4-x and the function ‘4-x’ is used in the plot command. (Remember that Maple is in effect merely showing a portion of the line of interest as a line is infinite in extent.) Try executing the following command: >plot( 4-x, x = -5..5 ); Now to illustrate the linear systems considered above and their solutions, we want to plot the two lines in each set on the same diagram. As before, this can be achieved by including the two linear functions as elements of a list or set within the plot command. This is illustrated below: >plot( {4-x, x-2}, x = -5..5 ); The same ideas can be used to investigate systems of three equations in three variables (where each equation represents a plane). For instance, the following commands solve a 3x3 system and represent it graphically: >solve( {2*x+z = 5, -x-4*y+2*z = 8, -4*x+5*y+8*z = -10} ); >plot3d( {5-2*x, (8+x+4*y)/2, (-10+4*x-5*y)/8}, x = -5..5, y=-5..5, axes=normal ); The plot command can only be used for plotting functions in two dimensions: to plot functions in three dimensions plot3d must be used. As before, in order to use the command we represent z as a function of x and y and then specify values for x and y to be used. This command does not automatically draw in the x,y and z co-ordinate axes. However, the option ‘axes=normal’ can be used to include the axes in the plot. Exercises: 1. Plot x+y = 4 and x+y = 3 on the same diagram. 2. What happens when you plot x+y = 4 and –2x-2y = -8 on the same diagram? 3. Change the value of axes from ‘normal’ to ‘framed’ and then to ‘boxed’ in the plot3d command used above and see what happens. 4. Change the intervals of values specified for x and y in the plot3d command given above and see what happens. 5. Plot the following planes in three-dimensional space: -2x+y+z = 1, 3x+7y+z = 2, 4x-2y-2z = 11. How do the planes intersect? How many solutions would you expect to the system of equations above? Verify this using the solve command. 6. For each of the following sets of planes a. x+y+z = –4, 2x–2y–z = 0, 4x+z = -8; b. x+2y+3z = 5, –y+2z = 8, x+3y+z = -10; investigate how the planes intersect, predict the type of solution you would expect the linear system to have and confirm your prediction using the solve command. 7. Solve the following 3 2 linear system: 2x-y=6, -3x+y=7, -5x-y=8. Plot these lines in two-dimensional space to confirm your result. 8. Solve the following homogeneous linear system: x+y+z =0, 2x–2y–z = 0. Plot these planes in three-dimensional space to confirm your result.