Math 4133 - Linear Algebra
Exam 1 - 2016.03.31
YOUR NAME HERE
(remember Alt+7 gives a text bracket)

1. Find the area of the triangle whose vertices are located at the three points:
 P(-2, 3, 2, 5, 1), Q(1, 1, 0, 1, 3), and R(5, 2, -1, 1, 1).

P = {-2,3,2,5,1};
Q = {1,1,0,1,3};
R = {5,2,-1,1,1};

PQ = Q-P;
PR = R-P;

0.5*Sqrt[Norm[PQ]^2*Norm[PR]^2-(PQ.PR)^2]

2. Compute the cross product of the two vectors: (OverVector[u]) = <-1, 2, 3>, and (OverVector[v]) = <2,0,1>.

u = {-1,2,3};
v = {2,0,1};

Cross[u,v]

3. Consider the following four vectors:
(OverVector[(Subscript[u, 1])]) = <2, 3, 4, -1, 2>, (OverVector[(Subscript[u, 2])]) = <1, 0, 1, 1, 0>, (OverVector[(Subscript[u, 3])]) = <3, 2, -1, 4, 5>, and (OverVector[(Subscript[u, 4])]) =  <-6, -3, 8, -12, -13>.
(a) Compute the dimension of the subspace spanned by the set {(OverVector[(Subscript[u, 1])]), (OverVector[(Subscript[u, 2])]), (OverVector[(Subscript[u, 3])]), (OverVector[(Subscript[u, 4])])}.
(b) Find a basis for the subspace spanned by the set {(OverVector[(Subscript[u, 1])]), (OverVector[(Subscript[u, 2])]), (OverVector[(Subscript[u, 3])]), (OverVector[(Subscript[u, 4])])}.
(c) Find a basis for the orthogonal subspace to the span of {(OverVector[(Subscript[u, 1])]), (OverVector[(Subscript[u, 2])]), (OverVector[(Subscript[u, 3])]), (OverVector[(Subscript[u, 4])])}.
(d) Compute the dimension of the subspace from part (c).

(Subscript[u, 1]) = {2,3,4,-1,2};
(Subscript[u, 2]) = {1, 0, 1, 1, 0};
(Subscript[u, 3]) = {3,2,-1, 4, 5};
(Subscript[u, 4]) = {-6, -3, 8, -12, -13};

(a) Compute the dimension of the subspace spanned by the set {(OverVector[(Subscript[u, 1])]), (OverVector[(Subscript[u, 2])]), (OverVector[(Subscript[u, 3])]), (OverVector[(Subscript[u, 4])])}.

RowReduce[{(Subscript[u, 1]),(Subscript[u, 2]),(Subscript[u, 3]),(Subscript[u, 4])}]//MatrixForm

Since the RowReduce command yields a row with all zeros, the dimension of the subspace is 3.

(b) Find a basis for the subspace spanned by the set {(OverVector[(Subscript[u, 1])]), (OverVector[(Subscript[u, 2])]), (OverVector[(Subscript[u, 3])]), (OverVector[(Subscript[u, 4])])}.

We use the three non-zero vectors from the above RowReduce command (part (a)).
(OverVector[(Subscript[v, 1])])= <1, 0, 0, 25/16, 11/16>, (OverVector[(Subscript[v, 2])]) = <0, 1, 0, -5/8, 9/8>, (OverVector[(Subscript[v, 3])]) = <0, 0, 1, -9/16,  -11/16>.

(c) Find a basis for the orthogonal subspace to the span of {(OverVector[(Subscript[u, 1])]), (OverVector[(Subscript[u, 2])]), (OverVector[(Subscript[u, 3])]), (OverVector[(Subscript[u, 4])])}.

We once again use the row reduction from part (a).  There are only two free variables (last two columns) and three dependent variables.  If we use the variables (Subscript[x, 1]), (Subscript[x, 2]), (Subscript[x, 3]), (Subscript[x, 4]), and (Subscript[x, 5]), the equations are:

(Subscript[x, 1]) + 25/16 (Subscript[x, 4]) + 11/16 (Subscript[x, 5]) = 0
(Subscript[x, 2]) -5/8 (Subscript[x, 4]) + 9/8 (Subscript[x, 5]) = 0
(Subscript[x, 3]) -9/16 (Subscript[x, 4])-11/16 (Subscript[x, 5]) = 0.

Which, in column vector form, looks like:
(({{(Subscript[x, 1])}, {(Subscript[x, 2])
(Subscript[x, 3])
(Subscript[x, 4])
(Subscript[x, 5])}})) = (({{-25/16}, {5/8
9/16
1
0}}))(Subscript[x, 4]) + (({{-11/16}, {-9/8
11/16
0
1}}))(Subscript[x, 5]) 

So the basis vectors for theorthogonal subspace is: 
{<-25/16, 5/8, 9/16, 1, 0>,<-11/16, -9/8, 11/16, 0, 1>}.

(d) Compute the dimension of the subspace from part (c).

The dimension is 2.  

(Note that the dimensions of the subspace and orthogonal subspace add up to 5, which is correct.)

4. Consider the set of all continuous functions on the closed interval [-1,1], which is denoted by the symbol C[-1,1], and the set B = {1, x, (x^2), (x^3), (x^4), (x^5)} and the subspace spanned by the set B.  Furthermore, let the dot product of two functions (vectors) in C[-1,1] be defined by the following integral (similar to HW problems from Chapter 8):

                                              f(x)* g(x) = (∫_(-1)^1)f(x)g(x)dx
                                              
 (a) Perform the Gram-Schmidt Orthonormalization Process on the basis B, and verify this result by computing the dot product matrix W.
 (b) Project the function G(x) = (Tanh^2)(4x-1).
 (c) Graph both G(x) and the projection computed in part (b).

(Subscript[f, 1])= 1; (Subscript[f, 2])= x;(Subscript[f, 3]) = x^2; (Subscript[f, 4]) = x^3;(Subscript[f, 5]) = x^4;(Subscript[f, 6])= x^5;

For[k=1, k≤ 6, k=k+1,
(Subscript[g, k]) = Simplify[(Subscript[f, k]) - Sum[Integrate[(Subscript[f, k])*(Subscript[g, j]),{x,-1,1}]/Integrate[(Subscript[g, j])*(Subscript[g, j]),{x,-1,1}]*(Subscript[g, j]),{j,1,k-1}]];
];

W= IdentityMatrix[6]-IdentityMatrix[6];

For[i=1,i≤6, i=i+1,
For[j=1,j≤ 6,j=j+1,
W[[i,j]]=Integrate[(Subscript[g, i])*(Subscript[g, j]),{x,-1,1}];
];
];

W//MatrixForm

For[i=1,i≤ 6, i=i+1,
(Subscript[h, i]) = 1/Sqrt[Integrate[(Subscript[g, i])*(Subscript[g, i]),{x,-1,1}]]*(Subscript[g, i]);
];

W2= IdentityMatrix[6]-IdentityMatrix[6];

For[i=1,i≤6, i=i+1,
For[j=1,j≤ 6,j=j+1,
W2[[i,j]]=Integrate[(Subscript[h, i])*(Subscript[h, j]),{x,-1,1}];
];
];

W2//MatrixForm

Table[(Subscript[g, i]),{i,1,6}]

Table[(Subscript[h, i]),{i,1,6}]

(b) Project the function G(x) = (Tanh^2)(4x-1)

ProjFunction = Sum[NIntegrate[(Subscript[h, i])*Tanh[4x-1]^2,{x,-1,1}]*(Subscript[h, i]),{i,1,6}];

Expand[ProjFunction]

(c) Graph both G(x) and the projection computed in part (b).

Plot[{ProjFunction,Tanh[4x-1]^2},{x,-1,1}]