1. Suppose we have a scalar function of several variables
(1)$\displaystyle f\colon{\mathbb R}^{3}\rightarrow{\mathbb R}$
Let ${\widehat{u}}$ be some unit vector. How does ${f}$ change in the ${\widehat{u}}$ direction?

We can consider this quantity as a function
(2)$\displaystyle g(\vec{x}) = \lim_{h\rightarrow0}\frac{f(\vec{x}+h\widehat{u})-f(\vec{x})}{h}$
What does this look like?

2. Lets restrict our attention to the smallest non-boring case: ${f\colon{\mathbb R}^2\rightarrow{\mathbb R}}$. Then we write ${\widehat{u} = \langle p,q\rangle}$. We have
(3)$\displaystyle f(\vec{x}+h\widehat{u}) = f(x+hp,y+hq).$
Expanding this to first order in ${h}$ lets us write
(4)\displaystyle \begin{aligned} f(x+hp,y+hq) &= f(x,y+hq) + hp\partial_{x}f(x,y+hq)+\mathcal{O}(h^{2})\\ &= \bigl(f(x,y)+hq\partial_{y}f(x,y)+\mathcal{O}(h^{2})\bigr)\\ &\quad+hp\partial_{x}\bigl(f(x,y)+hq\partial_{y}f(x,y)+\mathcal{O}(h^{2})\bigr)\\ &\quad+\mathcal{O}(h^{2})\\ &= f(x,y) + h\bigl(q\partial_{y}f(x,y) + p\partial_{x}f(x,y)\bigr) +\mathcal{O}(h^{2}). \end{aligned}
But what does this look like? It’s simply
(5)$\displaystyle f(\vec{x}+h\widehat{u}) = f(\vec{x}) + h\widehat{u}\cdot\langle\partial_{x},\partial_{y}\rangle f(\vec{x}) + \mathcal{O}(h^{2}).$

Example 1. What is the derivative of ${f(x,y)=x/y}$ in the direction of ${\vec{v}=\langle 1,3\rangle}$ at ${(5,3)}$?

Solution: We find the directional derivative is
(6)$\displaystyle v_{1}\partial_{x}f + v_{2}\partial_{y}f$
We compute
(7)$\displaystyle \partial_{x}f = 1/y$
and
(8)$\displaystyle \partial_{y}f = -x/y^{2}$
Thus we have
(9)$\displaystyle v_{1}\partial_{x}f + v_{2}\partial_{y}f = v_{1}(1/y) + v_{2}(-x/y^{2}).$
We plug in ${v_{1}=1}$, ${v_{2}=3}$
(10)$\displaystyle v_{1}\partial_{x}f + v_{2}\partial_{y}f = (1/y) + 3(-x/y^{2}).$
Then we evaluate ${(x,y)=(5,3)}$ to get
(11)$\displaystyle v_{1}\partial_{x}f + v_{2}\partial_{y}f = (1/3) + 3(-5/3^{2}) =-4/3.$
This gives us the directional derivative of ${f}$.

3. We denote
(12)$\displaystyle \vec{\nabla} = \langle\partial_{1},\dots,\partial_{n}\rangle$
and call it the “Gradient”. Note we will write ${\nabla}$ interchangeably with the vector arrow ${\vec{\nabla}}$, and they mean the same thing. The vector arrow doesn’t add anything semantically, it’s just different syntax.

The directional derivative is then
(13)$\displaystyle \widehat{u}\cdot\vec{\nabla}f(\vec{x}) = \widehat{u}\cdot\langle \partial_{1}f,\dots,\partial_{n}f\rangle.$
Note that the gradient acting on a scalar function produces a vector-valued function of several variables, but we can also take the dot product of the gradient with such a monstrosity.

4. Question: What is a vector-valued function of several variables?

For us, in practice, we think of this as a Vector Field: a “function” which assigns to each point a vector. Each vector-component is a function, usually smooth (i.e., infinitely differentiable).

(Again, just as we warned the reader with vectors, this too is a lie. A vector field is a bit more than just a function ${{\mathbb R}^{n}\rightarrow{\mathbb R}^{n}}$, it’s a more complicated beast which is studied further in differential geometry.)

5. Meaning of Gradient. Consider a family of level curves ${f(\vec{x})=c}$. The gradient points towards the direction of increasing ${c}$. How can we see this? Well, consider the function
(14)$\displaystyle f(x,y)=x^{2}-y^{2}.$
(15)$\displaystyle \vec{\nabla}f(x,y) = \langle 2x, -2y\rangle.$
Lets draw a few level-curves and see what the vectors point to:

We see the vectors point towards ${(x,y)\rightarrow(\pm\infty,0)}$.

Exercise 1. Consider the function ${f\colon{\mathbb R}^{2}\rightarrow{\mathbb R}}$ defined by ${f(x,y)=\ln(x^{2}+y^{2})}$. What is its gradient?

Exercise 2. Let ${g\colon{\mathbb R}^{3}\rightarrow{\mathbb R}}$ be defined by ${g(x,y,z) = (x^{2}+y^{2}+z^{2})^{-1/2}}$. Find its gradient.

Exercise 3. Let ${f(x,y,z)=x/(y+z)}$. Find its derivative in the direction ${\vec{u}=\langle 1,1,1\rangle}$ at the point ${(1,6,2)}$.

Exercise 4. Let ${f(x,y)=x\exp(-y) + 3y}$. Find its gradient.