Exam Questions

Question 1. Given the matrix equation AX = B, with  A = (({{2, -6, 3, -1}, {1, 2, 6, -1}})), B =  (({{1}, {-2}})), X = (({{(Subscript[x, 1])}, {(Subscript[x, 2])}, {(Subscript[x, 3])}, {(Subscript[x, 4])}})), express this as a system of linear equations.
Question 2. Solve the system of equations from problem 1.
Question 3. State the dimension of your solution to the system of equations.
Question 4. Express the solution found in Question 2 as S+(Subscript[y, p]) , where S is a subspace of (R^4) and (Subscript[y, p]) is a particular vector in (R^4).
Question 5. Convert the basis for the subspace S from Question 4 into an orthonormal basis.
Question 6. Project the vector w = <1, -2, 1, 4> on the subspace solution of the system of equations. 
Question 7. Compute the dot product matrix W for the orthonormal basis vectors found in Question 5
Question 8. Find the orthogonal complement (S^⊥) to the subspace found in Question 5.
Question 9. Verify that  S ⋃ (S^⊥) = (R^n) for the subspaces found in Questions 5 and 8.
Question 10: Convert the basis for (S^⊥) found in problem 9 into an orthonormal basis.
Question 11. Let A be the matrix whose columns are the basis vectors of S and  (S^⊥).  Compute the eigenvalues of this matrix.
Question 12. Verify that det(A) is equal to the product of the eigenvalues of A.
Question 13. The matrix A from problem 1 can be considered a linear map from (R^4) to (R^2). Compute Ker(A) and Im(A).
Question 14.  Consider the union of orthonormal bases of S = span{(Subscript[v, 1]), (Subscript[v, 2])} and (S^⊥)= span{(Subscript[u, 1]), (Subscript[u, 2])}  (I.e. your basis should be S ⋃ (S^⊥) = span{(Subscript[v, 1]), (Subscript[v, 2]), (Subscript[u, 1]), (Subscript[u, 2])} ).  From problem 9, we know that this union forms a basis for (R^4).  Express the vector w from problem 6 in terms of this basis.
Question 15. Consider the set of points  {{1.0, 0.75}, {1.4,0.92}, {2.0, 1.03}, {2.6,0.93}, {0.2, -1.82}, {0.8, -2.61}, {1.7, -2.93}, {3.2, -2.67}, {2.3, -2.89}, {3.6, 0.23}}.  Find the circle of best fit for the data points.  Graph both the points and circle on the same graph.

Question 1. Given the matrix equation AX = B, with  A = (({{2, -6, 3, -1}, {1, 2, 6, -1}})), B =  (({{1}, {-2}})), X = (({{(Subscript[x, 1])}, {(Subscript[x, 2])}, {(Subscript[x, 3])}, {(Subscript[x, 4])}})), express this as a system of linear equations.

{2(Subscript[x, 1])-6(Subscript[x, 2])+3(Subscript[x, 3])-(Subscript[x, 4])== 1, (Subscript[x, 1])+2(Subscript[x, 2])+6(Subscript[x, 3])-(Subscript[x, 4]) == -2}

Question 2.  Solve the system of equations from problem 1.

Solns = Expand[Solve[{2(Subscript[x, 1])-6(Subscript[x, 2])+3(Subscript[x, 3])-(Subscript[x, 4])== 1, (Subscript[x, 1])+2(Subscript[x, 2])+6(Subscript[x, 3])-(Subscript[x, 4]) == -2},{(Subscript[x, 1]),(Subscript[x, 2])}]]

Question 3. State the dimension of your solution to the system of equations.

The dimension is two since (Subscript[x, 1]) and (Subscript[x, 2]) depend upon (Subscript[x, 3 ])and (Subscript[x, 4]).

Question 4. Express the solution found in Question 2 as S+(Subscript[y, p]) , where S is a subspace of (R^4) and (Subscript[y, p]) is a particular vector in (R^4).

S = span{<-21/5, -9/10, 1, 0>, <4/5, 1/10, 0, 1}, and (Subscript[y, p]) = <-1, -1/2, 0, 0>.

Question 5. Convert the basis for the subspace S from Question 4 into an orthonormal basis.

(Subscript[v, 1])= {-21/5, -9/10, 1, 0};
(Subscript[v, 2]) = {4/5, 1/10, 0, 1};
(Subscript[q, 1])= (Subscript[v, 1]);
(Subscript[q, 2]) = (Subscript[v, 2]) - ((Subscript[v, 2]).(Subscript[q, 1]))/((Subscript[q, 1]).(Subscript[q, 1]))(Subscript[q, 1]);
(Subscript[q, 1]).(Subscript[q, 2])
(Subscript[vort, 1]) = (Subscript[q, 1])/Norm[(Subscript[q, 1])]
(Subscript[vort, 2]) = (Subscript[q, 2])/Norm[(Subscript[q, 2])]

Question 6. Project the vector w = <1, -2, 1, 4> on the subspace solution of the system of equations.

w = {1,-2,1,4};
projwontoS = Simplify[(w.(Subscript[vort, 1]))(Subscript[vort, 1]) + (w.(Subscript[vort, 2]))(Subscript[vort, 2])]

Question 7. Compute the dot product matrix W for the orthonormal basis vectors found in Question 5

DotProdW = ConstantArray[0,{2,2}];
For[k=1, k≤ 2, k=k+1,
For[j=1, j≤2, j=j+1,
DotProdW[[k,j]] = Simplify[(Subscript[vort, k]).(Subscript[vort, j])];];];
DotProdW//MatrixForm

Question 8. Find the orthogonal complement (S^⊥)to the subspace found in Question 5.

(Vmat = Join[{(Subscript[v, 1])},{(Subscript[v, 2])}])//MatrixForm

RowReduce[Vmat]//MatrixForm

(Subscript[u, 1]) = {-1/3, 8/3, 1, 0};
(Subscript[u, 2]) = {-3, 14, 0, 1};

Question 9. Verify that  S ⋃ (S^⊥)= (R^n) for the subspaces found in Questions 5 and 8.

(Umat = Join[{(Subscript[u, 1])},{(Subscript[u, 2])}])//MatrixForm

(UVMat = Join[Vmat,Umat])//MatrixForm

RowReduce[UVMat]//MatrixForm

Question 10: Convert the basis for (S^⊥) found in problem 9 into an orthonormal basis.

For[k=1, k≤2, k=k+1,
(Subscript[uq, k])= Simplify[(Subscript[u, k])-Sum[((Subscript[u, k]).(Subscript[uq, j])/((Norm[(Subscript[uq, j])])^2))(Subscript[uq, j]), {j,1,k-1}]];
(Subscript[uort, k])= (Subscript[uq, k])/Norm[(Subscript[uq, k])];];

List[(Subscript[uort, 1]),(Subscript[uort, 2])]

Question 11. Let A be the matrix whose columns are the  basis vectors of S and  (S^⊥).  Compute the eigenvalues of this matrix.

(VortMat = Join[{(Subscript[vort, 1])},{(Subscript[vort, 2])}])//MatrixForm

(UortMat = Join[{(Subscript[uort, 1])},{(Subscript[uort, 2])}])//MatrixForm

(UVortMat = Transpose[Join[VortMat, UortMat]])//MatrixForm

Simplify[(Subscript[uort, 1]).(Subscript[uort, 2])]
Simplify[(Subscript[vort, 1]).(Subscript[vort, 2])]
Simplify[(Subscript[uort, 1]).(Subscript[vort, 1])]
Simplify[(Subscript[uort, 1]).(Subscript[vort, 2])]
Simplify[(Subscript[uort, 2]).(Subscript[vort, 2])]

UVortMatEigs = N[Eigenvalues[N[UVortMat]]]

Question 12. Verify that det(A) is equal to the product of the eigenvalues of A.

Det[UVortMat]

Product[UVortMatEigs[[j]],{j,1,4}]

Question 13. The matrix A from problem 1 can be considered a linear map from (R^4) to (R^2). Compute Ker(A) and Im(A).

(A = (({{2, -6, 3, -1}, {1, 2, 6, -1}})))//MatrixForm

RowReduce[A]//MatrixForm

The Kernel of A is simply the subspace S from problem 4.

{(Subscript[v, 1]), (Subscript[v, 2])}

The image must be all of (R^2) due to a dimensional argument.

Question 14.  Consider the union of orthonormal bases of S = span{(Subscript[v, 1]), (Subscript[v, 2])} and (S^⊥)= span{(Subscript[u, 1]), (Subscript[u, 2])}  (I.e. your basis should be S ⋃ (S^⊥)=span{(Subscript[v, 1]), (Subscript[v, 2]), (Subscript[u, 1]), (Subscript[u, 2])}  ).  From problem 9, we know that this union forms a basis for (R^4).  Express the vector w from problem 6 in terms of this basis.

Since we have mutually orthogonal orthonormal bases, we simply use the projection technique:

w

Simplify[(w.(Subscript[vort, 1]))(Subscript[vort, 1])+(w.(Subscript[vort, 2]))(Subscript[vort, 2])+(w.(Subscript[uort, 1]))(Subscript[uort, 1])+(w.(Subscript[uort, 2]))(Subscript[uort, 2])]

Simplify[{w.(Subscript[vort, 1]), w.(Subscript[vort, 2]),w.(Subscript[uort, 1]), w.(Subscript[uort, 2])}]

Question 15. Consider the set of points  {{1.0, 0.75}, {1.4,0.92}, {2.0, 1.03}, {2.6,0.93}, {0.2, -1.82}, {0.8, -2.61}, {1.7, -2.93}, {3.2, -2.67}, {2.3, -2.89}, {3.6, 0.23}}.  Find the circle of best fit for the data points.  Graph both the points and circle.

EqnCircle = 2a  x+2b y+cv == ((x^2)+(y^2))
(Pts = {{1.0, 0.75}, {1.4,0.92}, {2.0, 1.03}, {2.6,0.93}, {0.2, -1.82}, {0.8, -2.61}, {1.7, -2.93}, {3.2, -2.67}, {2.3, -2.89}, {3.6, 0.23}})//MatrixForm
PtsPlot = Graphics[{PointSize[0.05], Blue, Point[Pts]}, Axes->True, PlotRange->{{-1,5},{-4,2}}];
For[k=1, k≤ 10, k=k+1,
(Subscript[Eqn, k]) = EqnCircle/.{x->Pts[[k,1]], y->Pts[[k,2]]}];
Table[(Subscript[Eqn, k]),{k,1,10}]//MatrixForm

(AMat = Join[2Pts, Transpose[{{1,1,1,1,1,1,1,1,1,1}}],2])//MatrixForm
(RHSMat = Transpose[{{1.5625,2.8064,5.0609, 7.6249, 3.3524, 7.4521, 11.4749, 17.3689,13.6421,13.0129}} ])//MatrixForm

(Inverse[Transpose[AMat].AMat].Transpose[AMat].RHSMat)//MatrixForm

-1.0208732618907996+(2.016966140878563^2)+ (((-0.9784109118032077))^2)

CircPlot = ContourPlot[(((x-2.016966140878563))^2)+(((y+0.9784109118032077))^2) == 4.0045670638953474, {x,-5, 5},{y,-5,5}, ContourStyle->{Red, Thickness[0.01]}, PlotRange->All, Axes->True, Frame->False, AspectRatio->1];

Show[PtsPlot, CircPlot]