Example 8.4.1

This notebook contains the interactive manipulation for example 8.4.1 of the text, the projection of a vector onto a subspace.  The idea is to take 2 vectors (OverVector[(Subscript[b, 1])]) and  (OverVector[(Subscript[b, 2])]) which are the basis for two-dimensional subspace in (ℝ^3) and a vector (OverVector[v]), and find the projection of (OverVector[v]) onto the subspace as well as the component of (OverVector[v]) which is orthogonal to the subspace.

For the manipulation, enter the vectors  (OverVector[(Subscript[b, 1])]) and  (OverVector[(Subscript[b, 2])]) (these will appear in blue and purple) and the vector (OverVector[v]) (which will appear in orange).  The manipulation will then plot the subspace (transparent blue plane) as well as the projection of (OverVector[v]) onto the subspace (in yellow) and the part of (OverVector[v]) that is orthogonal to the subspace (in red). It will also give the component form of both parts of (OverVector[v]).  You may freely rotate the picture; the direction in which the vector (OverVector[v]) is projected is slightly shaded to aid in perspective.

For completeness, the manipulation will check to make sure that (OverVector[(Subscript[b, 1])]) and  (OverVector[(Subscript[b, 2])]) are linearly independent.

VectorProject3D[ b1_, b2_, v_]:= 
Block[ {normal, projonnormal,projinplane, max,rawgraphics,t,u},
If[Cross[b1,b2]=={0,0,0}, Print["The vectors entered no not form a basis"];Return[] ];
max=Max[Norm[b1],Norm[b2],Norm[v]]+.5;
normal=Cross[b1,b2];
projonnormal= v.normal/Norm[normal]^2 normal;
projinplane=v-projonnormal;
rawgraphics={Thick,Blue, Arrow[ {{0,0,0},b1}], Purple, Arrow[ {{0,0,0},b2}], Orange,Arrow[{{0,0,0},v}],Yellow, Arrow[ {{0,0,0}, projinplane}], Red,Arrow[ {projinplane,v}], Red, Opacity[.1],Polygon[{{0,0,0}, projinplane,v}] };
Column[{Row[{"The projection of ",v, " onto the subspace is ", projinplane,"."}],Row[{"The component of ", v, " orthogonal to the subspace is ",projonnormal,"."}],Show[Graphics3D[rawgraphics], ParametricPlot3D[ t b1 + u b2,{t,-2 max,2max},{u,-2 max,2 max}, Mesh->False, PlotStyle->{Blue,Opacity[.3]}],PlotRange->{{-max,max},{-max,max},{-max,max}}, Axes->True, AxesLabel-> {"x","y","z"}, AxesEdge-> {{-1,-1},{-1,-1},{-1,-1}}, ImageSize->400]}]
];

Manipulate[VectorProject3D[ u,v,w],{{u,{5,-2,9}, "Basis Vector 1"}, InputField}, {{v,{-3,7,1},"Basis Vector 2"},InputField},Delimiter, {{w,{4,8,-15},"Vector to Project"},InputField}, SaveDefinitions->True]