A vector in space is written a1i + a2j + a3k. Its magnitude comes from Pythagoras in three dimensions, and dividing a vector by its magnitude gives the unit vector in its direction. The components of that unit vector are the direction cosines.
There are two ways to multiply vectors. The scalar product (dot product) gives a number and is used for angles, perpendicularity, projections and work done. The vector product (cross product) gives a new vector at right angles to both and is used for areas.
Combining them gives the scalar triple product, a single determinant that measures volume and tests whether three vectors lie in one plane.