Matematik och Datavetenskap, Chalmers Tekniska Högskola och Göteborgs Universitet

ALA-B, 2006, studio 2.3

Hemsida, Matlab: analys, linjär algebra, facit.

Linear equations.

In these exercises you should do all computations first by hand and then with Matlab.

1. Column vectors. Addition and multiplication by a scalar. Form the following column vectors in R4: a=[1; 2; 3; 4], b=[4; 3; 2; 1], c=2*a-3*b

2. Scalar product (dot product). Compute the scalar products (a,b), (b,a). Hint: the scalar product (a,b) is easily computed as b'*a. Compute these first by by hand and then with Matlab.

3. Matrix, Lay 1.4. Form the matrix A=[a b c]. Compute the type of A (in Matlab: size(A)). Compute A*x with x=[1; 2; 3]. Compute A*b and explain why this is does not work. Compute A(:,2) and A(1,:).

4. Linear combinations, Lay 1.3, 1.4. Compute

2*a - 4*b + c,
Ax with x=[2;-4;1] and A as above,
A*x with x=[1;0;0], x=[0;1;0], x=[0;0;1].

Note that the first one is equal to the second one. Lay 1.4: Ax is a linear combination of a,b,c, namely, Ax=x_1a+x_2b+x_3c.

Define V=Span(a,b,c)=the space of linear combinations of a,b,c, as in Lay 1.3.

Does v=[1; 1; 1; 1] belong to V?

Hint: v is in V if v=Ax, so we must solve Ax=v. By hand: Gauss elimination. In Matlab: the reduced row echelon matrix is computed by the function rref(A). To solve Ax=v, form the augmented matrix B=[A v], and do rref(B). Then solve the reduced system by hand.

Answer: x=[.2;.2;0]+t*[-2;3;1], so that v=(.2-2*t)*a + (.2+3*t)*b + t*c, where t is an arbitrary number.

Does v=[1; 1; 1; 0] belong to V? Answer: no, Ax=v has no solution.

5. Linear independence, Lay 1.7. Check if the vectors a,b,c are linearly independent: solve the equation x_1a+x_2b+x_3c=0, which can be written Ax=0. Use the Gauss elimination method by hand. In Matlab the reduced row echelon matrix is computed by the function rref(A).

Show that the following are linearly independent:

(a) a,b    hint: B=[a b], solve Bx=0 by Gauss elimination
(b) a,c    hint: C=[a c], solve Cx=0 by Gauss elimination
(c) b,c    hint: D=[b c], solve Dx=0 by Gauss elimination

Since you have already done Gauss elimination by hand several times, you can now save time by using the Matlab function rref.

6. Solve exercises from Lay, Chapter 1, by using Matlab.

/stig


Last modified: Mon Dec 1 15:43:15 MET 2003