Before discussing directional cosines of a vector, let us discuss the position vector. As the name suggests, a position vector indicates the position of any point relative to any reference origin.
Consider any arbitrary point in three-dimensional space having the co-ordinates (x,y,z) as with respect to the origin O (0,0,0).
The following figure represents a vector P in space with O  as reference origin. Let the position vector make positive angle (anticlockwise direction) of α , β and γ with the positive x , y and z axis respectively. These angles are known as direction angles and on taking the cosine of these angles we get direction cosines. Taking direction cosines makes it easy to represent the direction of a vector in terms of angles with respect to the reference.
From the above diagram we can easily figure out the direction cosines of the position vector as
The co-ordinates of the point P may also be expressed as the product of the magnitude of the given vector and the cosines of direction on the three axes, i.e.
a = lr
b = mr
c = nr
where  l,m,n represent the direction cosines of the given vector on the axes X,Y,Z respectively. We can clearly see that lr,mr,nr  are in proportion to the direction cosines and these are called as the direction ratios and they are denoted by a,b,c .
\(\begin{array}{l} Â \frac {1}{\sqrt{x^2 + y^2 + x^2}} \end{array} \)
Let us now practice some examples based on the above theory,
Example: The co-ordinates of a point P(x,y,z) are (3,4,5). Determine the direction cosines and the direction ratios of the given point taking origin O (0,0,0) Â as reference.
Solution: Let us represent the given point in three-dimensional Cartesian space as shown