Step 1: Recall what direction cosines mean.
The direction cosines of a vector are the cosines of the angles it makes with the positive $x$, $y$ and $z$ axes. They tell us the vector's direction, not its length.
Step 2: Write the vector and its length.
For $\vec a = a_1 \hat i + a_2 \hat j + a_3 \hat k$, the length is $|\vec a| = \sqrt{a_1^2 + a_2^2 + a_3^2}$.
Step 3: Build the unit vector.
Dividing the vector by its length gives the unit vector $\hat a = \frac{a_1}{|\vec a|}\hat i + \frac{a_2}{|\vec a|}\hat j + \frac{a_3}{|\vec a|}\hat k$, which points the same way but has length $1$.
Step 4: Connect the unit vector to the cosines.
The components of a unit vector are precisely the cosines of the angles with the axes. So they ARE the direction cosines.
Step 5: Read off the three cosines.
Therefore the direction cosines are $\frac{a_1}{|\vec a|}$, $\frac{a_2}{|\vec a|}$, $\frac{a_3}{|\vec a|}$.
Step 6: Quick check.
Their squares add to $\frac{a_1^2 + a_2^2 + a_3^2}{|\vec a|^2} = 1$, exactly as direction cosines should. \[ \boxed{\dfrac{a_1}{|\vec a|},\ \dfrac{a_2}{|\vec a|},\ \dfrac{a_3}{|\vec a|}} \]