(a) Non-singular matrix. Form the matrix A=[1 2 3; 4 5 6; 1 1 2] and the unit matrix I=eye(size(A)). Then compute rref([A,I]) and collect the colums 4 to 6 of the answer B=ans(:, 4:6). Compute the determinant of A, det(A), and compute the products A*B and B*A. Try also inv(A).
(b) Singular matrix. Try the same with A=[1 2 3; 4 5 6; 1 1 1].
2. Change of basis, Ch 41.14. Let
s1=[1;2;3], s2=[3;2;1], s3=[0;1;1], S=[s1, s2, s3]
e1=[1;0;0], e2=[0;1;0], e2=[0;0;1], I=[e1, e2, e3]
Show that s1,s2,s3 are linearly independent. (Hint: solve Sx=0 by using rref(S).) Show that e1,e2,e3 are linearly independent.
e1,e2,e3 are three linearly independent vectors in R^3. Therefore they are a basis for R^3. We call it the "standard basis" or the "old basis".
s1,s2,s3 are three linearly independent vectors in R^3. Therefore they are a basis for R^3. We call it the "new basis".
The equation x=Sy can be seen as a coordinate transformation, where x contains the components of the vector x with respect to the standard (old) basis, y contains the components of the vector x with respect to the new basis s1,s2,s3, and where S=[s1, s2, s3] contains the new basis vectors expressed with respect to the old basis. This is because x=Sy=y1s1+y2s2+y3s3 expresses x as a linear combination of s1, s2, s3 with coefficients y1, y2, y3.
The columns of S are linearly independent, which implies that det(S) is not 0, so that the inverse matrix S-1 exists. Therefore the new components are given by y=S-1x.
Compute the new components y of
(a) x=[1;1;1] hint: use inv(S)
(b) x=[6;4;2]
(c) x=[0;-1;-1]
Answer: (b) y=[0;2;0] because x=2*s2, (c) y=[0;0;-1] because x=-s3
3. Orthonormal basis, Gram-Schmidt process, Ch 41.36. Now we will re-arrange the basis s1, s2, s3 into an orthonormal basis q1, q2, q3 by means of the Gram-Schmidt process. (Do the computations with matlab whenever possible.)
(a) Let k1=s1, normalize q1 = k1 / || k1 || .
(b) Let k2 = s2 - t *q1 be a linear combination of s2 and
q1. Determine the coefficient t so that k2 is orthogonal
to q1.
(Make sure you understand the following equation.)
0 = (k2,q1) = (s2,q1) - t (q1,q1) = (s2,q1) - t, t = ?
Normalize: q2 = k2 / || k2 || .
Note that, with this value of t, the vector t*q1 = P1s2 is the projection of s2 onto the subspace V1=span(q1)=span(s1), and k2 = s2 - P1s2.
(c) Let k3 = s3 - t *q1 - s*q2 be a linear combination of s3, q1, and q2. Determine the coefficients t, s so that k3 is orthogonal to q1 and q2.
0 = (k3,q1) = (s3,q1) - t (q1,q1) - s (q2,q1) = (s3,q1) - t,
t =?
0 = (k3,q2) = (s3,q2) - t (q1,q2) - s (q2,q2) = (s3,q2) - s,
s =?
Normalize: q3 = k3 / || k3 ||.
Note that, with these values of t and s, the vector t*q1 + s*q2 = P2s3 is the projection of s3 onto the subspace V2=span(q1,q2)=span(s1,s2), and k2 = s3 - P2s3.
Note that q1, q2, q3 are orthogonal to each other and that they are normalized, i.e., they are an orthonormal basis, ON basis.
(d) Form the transformation matrix Q = [q1 q2 q3].
4. Orthogonal matrix, Ch 41.37. Show that Q is an orthogonal matrix by computing Q'*Q and Q*Q'.
5. Orthogonal transformation, Ch 41.38 The equation x=Qy can be seen as a coordinate transformation, where x contains the components of the vector x with respect to the standard (old) basis, y contains the components of the vector x with respect to the new basis q1,q2,q3, and where Q=[q1, q2, q3] contains the new basis vectors expressed with respect to the old basis.
The columns of Q are orthonormal, which implies that the inverse matrix Q-1 = QT exists. Therefore the new components are given by y=QTx.
Compute the new components y of
(a) x=[1;1;1]
(b) x=[6;4;2]
(c) x=[0;-1;-1]
In each case check that the norms of the vectors x and y are the same: || x || = || y ||, i.e., || x || = || Qx ||, see Ch 41.37.
The formula y=QTx means that the components can be computed as y1 = (x,q1), y2 = (x,q2), y3 = (x,q3). Try this! Simple, isn't it? This is not true for a non-orthonormal basis such as s1, s2, s3, where y=S-1x and we have to compute the inverse of S first, or solve the system of equations Sy=x.
/stig