Example 6.4.1

This notebook shows the geometric interpretation of vector projection given in example 6.4.1.  Given vectors (OverVector[v]) (in blue) and (OverVector[w]) (in green),  the projection of (OverVector[w]) onto (OverVector[v]), (Subscript[proj, (OverVector[v])])((OverVector[w])), is given in red. The vectors (OverVector[w]) and (OverVector[v]) may be changed by dragging their endpoint.  Also shown in gray is the vector (OverVector[w])-(Subscript[proj, (OverVector[v])])((OverVector[w])), which is always orthogonal to (OverVector[v]).

DisplayProjectedVector[w_,v_]:=Block[{graphics, proj, perpendicular,k},
proj=w.v/v.v v;
perpendicular=w-proj;
graphics=Graphics[{Thick,Blue, Arrow[{{0,0},v}], Green,Arrow[ {{0,0}, w}], Red,Arrow[ {{0,0},proj}], Gray, Arrow[ {proj, w}], Black,Text[ "w", w+{.25,.25}],Text["v", v+{.25,.25}]}];
Return[ Column[ {Show[graphics, PlotRange->{{-5,5},{0,5}}, AspectRatio->Automatic, Axes->True, Ticks->{Table[k,{k,-5,5}],Table[k,{k,-5,5}]}, ImageSize->400],
Row[ {"The vector projection of the green vector w ", w, " onto the blue vector v ",v," is the red vector ", proj}]}]]
]

Manipulate[DisplayProjectedVector[w1,v1],{{v1,{3,0}},Locator, Appearance->None}, {{w1,{2,3}},Locator, Appearance->None}, SaveDefinitions->True]