Write the component of along .
Component of a given vector along is given by the length of on .
Let be the angle between both the vectors.
So the length of on is given as:
By vector dot product, we know that:
Cos =
Therefore,
Hence,