Maple Assignment 1 with Solutions - Linear Algebra | MATH 2270, Assignments of Linear Algebra

Material Type: Assignment; Class: Linear Algebra; Subject: Mathematics; University: University of Utah; Term: Unknown 2002;

Typology: Assignments

Pre 2010

Uploaded on 08/30/2009

koofers-user-igq
koofers-user-igq 🇺🇸

4

(1)

9 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Math 2270 Sec. 2 MAPLE Assignment #1: Solutions.
> with(linalg):
Warning, the protected names norm and trace have been redefined and unprotected
You are to create a document in which you answer the following questions, using a mixture
of MAPLE computations and textual insertions (using # to comment or handwritten text.)
Each problem is worth 5 points.
1.a Define
( 2 3 4 ) ( 3 2 1 )
A = ( 5 6 7 ) , B = ( 4 3 2 ) .
( 8 9 0 ) ( 5 4 3 )
Compute AB and BA. Are they the same?
Solution:
> A:= matrix([[ 2 , 3, 4], [5, 6, 7], [8, 9, 0]]);
:= A
234
567
890
> B:= matrix([[3, 2, 1 ], [4 , 3, 2], [5, 4, 3]]);
:= B
321
432
543
> multiply(A,B);
38 29 20
74 56 38
60 43 26
> multiply(B,A);
24 30 26
39 48 37
54 66 48
The products AB and BA are not the same.
1.b. Compute A + B and B + A. Are they the same?
Solution:
> evalm(A+B);
5 5 5
9 9 9
13 13 3
pf3
pf4
pf5

Partial preview of the text

Download Maple Assignment 1 with Solutions - Linear Algebra | MATH 2270 and more Assignments Linear Algebra in PDF only on Docsity!

Math 2270 Sec. 2 MAPLE Assignment #1: Solutions.

with(linalg):

Warning, the protected names norm and trace have been redefined and unprotected

You are to create a document in which you answer the following questions, using a mixture

of MAPLE computations and textual insertions (using # to comment or handwritten text.)

Each problem is worth 5 points.

1.a Define

( 2 3 4 ) ( 3 2 1 )

A = ( 5 6 7 ) , B = ( 4 3 2 ).

( 8 9 0 ) ( 5 4 3 )

Compute AB and BA. Are they the same?

Solution:

A:= matrix([[ 2 , 3, 4], [5, 6, 7], [8, 9, 0]]);

A :=

B:= matrix([[3, 2, 1 ], [4 , 3, 2], [5, 4, 3]]);

B :=

multiply(A,B);

multiply(B,A);

The products AB and BA are not the same.

1.b. Compute A + B and B + A. Are they the same?

Solution:

evalm(A+B);

evalm(B+A);

Therefore A+B and B+A are the same.

1.c. Define C to be A + B. Compute C^2 and compare it to

A^2 + 2AB + B^2.

Are they the same? Can you think of a small change you could make in the

expression A^2 + 2AB + B^2 in order to make it equal to C^2?

Solution.

C:=evalm(A+B);

C :=

evalm(C^2);

evalm(A^2+B^2+2A&B);

evalm(A^2+B^2+A&B + B&A);

Therefore

C^2= A^2+B^2+A.B + B.A;

C =

2 A + + +

2 B

2 ( A. B ) ( B. A )

1.d. Compute the transpose of AB and compare it to the product of the transpose of A

and the transpose of B multiplied in the correct order to get equality.

transpose(A&*B);

J :=

col(J, 4);# The last column of the matrix J is the solution

vector.

Solution using linsolve:

x:=linsolve(A,v);

x :=

Solution using the inverse matrix: x=inverse(A)&*v.

evalm( inverse(A)&* v);

2.a Solve Bx = w where B is as above and w=(1,2,3). Verify that your

solution solves Bx = w.

Solution.

w:= vector([1,2,3]);

w :=[ 1 2 3, , ]

augment(B, w);

K:=rref(%);

K :=

We this see that the system has infinitely many solutions. We can find them all using linsolve;

note that the vector

col(K, 4);

[ -1 2 0, , ]

is only one solution of the system.

X:=linsolve(B, w);

X :=[ _t , , ] 1

− 2 _t 1

_t + 1

Hence MAPLE’s solution is: x=t, y=-2t, z=t+1. Let’s check that this solution really works:

evalm(B&*X);

[ 1 2 3, , ]

which is indeed the vector w of the right hand side.

2.b Repeat your work in order to solve Bx = z where z = (1,2,4). Explain

your answer.

Solution.

z:=vector([1,2,4]);

z :=[ 1 2 4, , ]

Y:=linsolve(B, z);

Y :=

So, MAPLE could not find a solution. Let’s see what is wrong by using RREF:

rref(augment(B, z));

Thus the last equation says 0=1, i.e. the system has no solutions. What is happening here is that the

vector

w is in the image of B, but the vector z is not.

3.a Plot the graph of the line x/2 + 3y=7 on the interval x=2..

using both plot and implicitplot commands

Solution.

with(plots):

solve(x/2+ 3*y=7, y);

x

plot(%, x=2..4); #Ordinary plot

3.b. By plotting lines (anyway you like) determine if the system of

equations 3x+2y=5, 2x-y=3 has a solution and if the solution is unique

Solution.

L1:=implicitplot(3x+2y=5, x=-1..3, y=-2..2):

L2:= implicitplot(2*x-y=3, x=-1..3, y=-2..2):

display({L1,L2});

0

1

2

y

0.5 1 1.5 2 2.5 3

x

Therefore the lines intersect in a single point, which means that the system has unique solution.