# directional derivative unit vector

I just recently learned about directional derivatives and I am really lost on how they come up with unit vector or direction. I get that they come up with partial derivatives for each function and to each partial derivative multiply by its unit vector but what I dont understand is how they come up with that unit vector. For example I have a solved question below that puzzles me on how they found its unit vector.

• If you have an angle $\theta$, the unit vector in that direction is $(\cos \theta, \sin \theta)$. – Javier Mar 8 '12 at 20:24

The direction is something you can change at whim, independently of the function itself, so there's no place it "comes" from in this problem any more than there is a place the function itself "comes" from. Of course given the angle of the direction we want to investigate, we can explicitly write the direction with unit vector $(\cos\theta,\sin\theta)$; here $\theta$ is $\pi/4$, representing a perfect Northeast direction, but it could have been chosen to be anything else.
The direction is given by the angle $\theta=\pi/4$. One vector in this direction is $(1,1)$. But you can't use this for the direction vector in the definition of the directional derivative. You need a vector of length one. So, take $(1,1)$ and divide it by its length: $\sqrt{ 1^2+1^2}=\sqrt 2$. This gives a "proper" direction vector (that is a unit vector):$$\textstyle{1\over\sqrt2}(1,1)= ({1\over\sqrt2},{1\over\sqrt2}) =({\sqrt2\over2},{\sqrt2\over2}).$$
I imagine, though, in the answer in you post, they recalled from memory the values of $\cos$ and $\sin$ for $\theta=\pi/4$ to obtain the (unit) direction vector.