MTH 212 Lab on 2/11/2019. Vectors.

u={1,3,2}; 
v={2,3,5};
u+v (* vector addition *)
2 *u (* multiplication by a scalar *)

(* graphing u, v and u+v *)
Graphics3D[{Arrowheads[Large],{Red,Arrow[{{0,0,0},u}], Arrow[{v,u+v}]},{Blue,Arrow[{u,u+v}],Arrow[{{0,0,0},v}]},Arrow[{{0,0,0},u+v}], 
Text[Style["u",Large, Bold],{1.1,3.1,2.1}],
Text[Style["v",Large, Bold],{2.1,3.1,5.1}],
Text[Style["u+v",Large, Bold],{3.2,6.2,7.2}],
Axes->True, AxesLabel->{x,y,z}}]

(* graphing u, -u, and 2u *)
Graphics3D[{Arrowheads[Large],{Red,Arrow[{{0,0,0},u}]},{Blue,Arrow[{{0,0,0},2u}]},Arrow[{{0,0,0},-u}],
Text[Style["u",Large, Bold],{1.1,3.1,2.1}],Text[Style["2u",Large, Bold],{2.1,6.1,4.1}],
Text[Style["-u",Large, Bold],{-1.1,-3.1,-2.1}],
Point[{0,0,0}],Axes->True, AxesLabel->{x,y,z}}]

c=u.v (* dot product *) 
angle=ArcCos[c/(Sqrt[u.u]*Sqrt[v.v])] (* angle between u and v *)
N[angle]

(* length of v *)
Sqrt[v.v]
(* OR: USE BUILT-IN FUNCTION *)
Norm[v]
(* Unit vector in the direction of v *)
v/Norm[v]
(* OR: USE BUILT-IN FUNCTION *)
Normalize[v]
(* projection of u onto v *)
myProj = (u.v)v/(Norm[v]^2)
(*OR: USE BUIlT-IN FUNCTION *)
MathProj = Projection[u,v]

Graphics3D[{Arrowheads[Large],{Red,Arrow[{{0,0,0},u}]},{Blue,Arrow[{{0,0,0},v}]},Arrow[{{0,0,0},myProj}], 
Text[Style["u",Large, Bold],{1.1,3.1,2.1}],Text[Style["v",Large, Bold],{2.1,3.1,5.1}],
Text[Style["projection of u onto v",Bold],{1.1, 1.5,3}],
Point[{0,0,0}],Line[{u,myProj}],Axes->True, AxesLabel->{x,y,z}}]

Graphics3D[{Arrowheads[Large],{Red,Arrow[{{0,0,0},u}]},{Blue,Arrow[{{0,0,0},v}]},Arrow[{{0,0,0},myProj}],
 Arrow[{myProj,u }],
Text[Style["u",Large, Bold],{1.1,3.1,2.1}],Text[Style["v",Large, Bold],{2.1,3.1,5.1}],
Text[Style["myProj",Bold],{1.1, 1.5,3}],
Text[Style["u-myProj",Bold],{0.1,2.2,2.1}],
Point[{0,0,0}],Axes->True, AxesLabel->{x,y,z}}]