## Directional Derivatives Part 2: Dot Products and Arbitrary Directions.

### May 17, 2010

Last time, we talked about the gradient.  Let’s remind ourselves of what this means: for an arbitrary function (let’s say, of two variables) $f(x,y)$ we have the associated vector field $\nabla f(x,y) = (\frac{\partial f}{\partial x}, \frac{\partial f}{\partial y})$

Now, we need to introduce the dot product.  While the dot product of two things is relatively easy to calculate, it’s a bit tricky to figure out what it "means" to take the dot product of two vectors.  Let’s define this first:

$A\cdot B = |A||B|\cos(\theta)$

where $|A|$ is the length of the vector $A$ (given as its magnitude, calculated in the standard way: the square root of the sum of the square of its components!) and $\theta$ is the angle between the two vectors.  Let’s note here that the dot product takes two vectors and spits out a scalar.

But what does the dot product mean?  Let’s look at this picture, stolen from wikipedia shamelessly.  Notice that the scalar projection of the vector A onto the vector B has length $|A|\cos(\theta)$; that is, it’s how long A is when we "project" it down onto B.  To obtain the dot product, we take this projection length and multiply it by the length of B.  Kind of a strange idea, no?  Why would we do such a thing?

Nonetheless, this is not a study of the dot product, and to do so would move us farther away from our original topic!  But using the dot product, we can define the directional derivative this way.

Let’s look at a specific function before we consider the directional derivative.

This pretty function is $F(x,y) = -(x^2 + y^2 + xy)$.  (By the by, I made this in Mathematica, which is a pretty sweet program to make pictures!)  Now, let’s pick a point and take the partial derivatives.

So, we’ve done that.  One of those red arrows points directly in the x-direction, and the other points in the y-direction.

Now, let’s pretend we want our derivative in some other direction.  Say we want it in the direction of that purple arrow in the picture.  This is between the two partial derivatives.  Now, wait a momentâ€¦!  The two magnitudes "project" onto our new direction and contribute to some of the magnitude of the derivative in that direction!  This sounds like dot product material right there.

Our first order of business is to make this easier for ourselves: instead of using the full vector for the direction we want to derive in, let’s make it into a unit vector.  This is usually pretty easy: just divide by its magnitude.  Now we can suppose that the vector of the direction we want to derive in is a unit vector.  Let’s call this vector ${\vec u} = (u_1, u_2)$ in honor of its unit-ness.

Let’s get right down into the meat of this thing: the way to find the magnitude of the derivative in the direction of ${\vec u}$, we need only find

${\vec u}\cdot \nabla f(x,y)$

and in order to understand this formula, we need only think of what each part means: this formula gives us "how much the partial in the x-direction acts in the ${\vec u}$ direction?  how much of the partial in the y-direction acts in the ${\vec u}$ direction?" and this allows us to judge the magnitude of the derivative.  After we have the magnitude, all we need is the direction — but, wait!  We already know the direction: it’s just ${\vec u}$!  So, the directional derivative is just

$D_{{\vec u}}f(x,y) = ({\vec u}\cdot \nabla f(x,y)){\vec u}$

which is pretty nice looking.  Notice that the left hand side says $D_{{\vec u}}f(x,y)$: this is a nice way to write "derivative in the direction of ${\vec u}$ at the point (x,y)" compactly.  Now, all this theory is nice and all, but let’s do an example or two.

Examples:

1. Let’s let $f(x,y) = -(x^2 + y^2 + xy)$ like in that pretty picture above.  First, $\nabla f(x,y) = (-2x - y, -2y-x)$.  So, that’s nice.  Now, let’s take the directional derivative at the point $(1,2)$ with ${\vec u} = (\frac{\sqrt{2}}{2}, \frac{\sqrt{2}}{2})$.  Notice that this is a unit vector!  Now that we have all of this, we find that ${\vec u}\cdot\nabla f(1,2) = \frac{\sqrt{2}}{2}(-4) + \frac{\sqrt{2}}{2}(-5) = \frac{-9\sqrt{2}}{2}$.  Therefore, the vector for the directional derivative in the direction of ${\vec u}$ is equal to $D_{(\frac{\sqrt{2}}{2}, \frac{\sqrt{2}}{2})} f(1,2) = \frac{-9\sqrt{2}}{2}(\frac{\sqrt{2}}{2}, \frac{\sqrt{2}}{2}) = (\frac{-18}{4}, \frac{-18}{4}) = (\frac{-9}{2},\frac{-9}{2})$.
2. Let’s let $g(x,y) = xy$.  Let’s find the directional derivative in the direction of ${\vec v} = (3,4)$ at the point (1,1).  Then $\nabla g(x,y) = (y,x)$, and so $\nabla g(1,1) = (1,1)$.  Cool.  Now, the vector $(3,4)$ is not a unit vector, so we must divide by the magnitude, which happens to be 5.  The unit vector is $u = (\frac{3}{5}, \frac{4}{5})$.  So, the magnitude of the directional derivative is $\nabla g(1,1)\cdot {\vec u} = \frac{3}{5} + \frac{4}{5} = \frac{7}{3}$, and so the full directional derivative is: $D_{(3,4)}(\frac{21}{15}, \frac{28}{15})$.

Exercises:

Let $f(x,y) = 2x + 2y + x^2 + y^2$.

1. Find the directional derivative at the point (1,2) in the direction of ${\vec u} = (1,1)$.
2. Is there anywhere on this function that the directional derivative in all direction will be 0?  What happens at this point on the surface?

Now consider the function $g(x,y) = x^2 - y^2$

1. Find the directional derivative at the point (-1,1) in the direction of ${\vec u} = (5,12)$.
2. Is there anywhere on this function that the directional derivative in all direction will be 0?  What happens at this point on the surface?  Why is this different from the previous problem?

By the way, the first surface above has a minimum point at the point where its directional derivatives are all zero, but this surface has neither a maximum nor a minimum at the point where its directional derivatives are all zero.  When the directional derivatives are all zero but the surface has neither a maximum nor a minimum, we call the point a saddle point.  Looking at the graph, you can probably guess why!  In the next post, we’ll talk about when a point is a maximum, minimum, or a saddle point using cool generalizations of the standard two-variable derivative tests.