3. Partial Derivatives

Directional Derivatives And Gradient

Introduces directional derivatives and the gradient vector, emphasizing maximum rate of change.

Directional Derivatives and the Gradient

Welcome, students! Today we’re diving into the fascinating world of directional derivatives and the gradient vector. By the end of this lesson, you'll understand how to find the rate of change of a function in any direction and why the gradient is a powerful tool that points us toward the steepest ascent. Ready to explore the math behind how a hiker finds the fastest way up a hill? Let’s go! 🏔️

What Are Directional Derivatives?

Imagine you’re standing on a hill, surrounded by rolling terrain. You’re curious: in which direction should you walk to climb as fast as possible? Or maybe you’re wondering how steep the slope is if you walk east. This is where directional derivatives come in!

A directional derivative measures how fast a function changes as you move in a specific direction. In other words, it tells you the slope of the surface at a point, but not just in the usual $x$ or $y$ directions. You can pick any direction you want!

Formal Definition

Let’s say we have a function $f(x, y)$ that gives the height of a surface at any point $(x, y)$. The directional derivative of $f$ at the point $(x_0, y_0)$ in the direction of a unit vector $\mathbf{u} = \langle u_1, u_2 \rangle$ is defined as:

D_{$\mathbf{u}$} f(x_0, y_0) = $\lim_{t \to 0}$ $\frac{f(x_0 + t u_1, y_0 + t u_2) - f(x_0, y_0)}{t}$

This definition looks a lot like the definition of the regular derivative, except now we’re moving in the direction of $\mathbf{u}$ instead of just along the $x$-axis or $y$-axis.

Example: A Simple Surface

Let’s consider a simple function: $f(x, y) = x^2 + y^2$. This describes a paraboloid, kind of like a bowl. If you’re at the point $(1, 1)$, how steep is the slope if you walk northeast, in the direction $\mathbf{u} = \langle \frac{\sqrt{2}}{2}, \frac{\sqrt{2}}{2} \rangle$?

We’ll come back to this example after we’ve learned how to calculate the directional derivative easily using the gradient. But first, let’s talk about the gradient itself!

The Gradient Vector: The Direction of Greatest Increase

The gradient is like a compass that points you in the direction of the steepest climb. It’s a vector that contains all the partial derivatives of the function. For a function $f(x, y)$, the gradient is defined as:

$\nabla$ f(x, y) = $\left$\langle \frac{\partial f}{\partial x}(x, y), \frac{\partial f}{\partial y}(x, y) $\right$\rangle

Let’s break that down:

  • $\frac{\partial f}{\partial x}(x, y)$ is the partial derivative of $f$ with respect to $x$. It tells us how $f$ changes if we move a tiny bit in the $x$-direction.
  • $\frac{\partial f}{\partial y}(x, y)$ is the partial derivative of $f$ with respect to $y$. It tells us how $f$ changes if we move a tiny bit in the $y$-direction.

Together, these two partial derivatives form the gradient vector $\nabla f(x, y)$, which points in the direction where $f$ increases the fastest. The length of the gradient vector tells us how steep the climb is in that direction.

Example: Finding the Gradient

Let’s return to our function $f(x, y) = x^2 + y^2$. To find the gradient, we need to compute the partial derivatives.

  • $\frac{\partial f}{\partial x}(x, y) = 2x$
  • $\frac{\partial f}{\partial y}(x, y) = 2y$

So the gradient is:

$\nabla$ f(x, y) = \langle 2x, 2y \rangle

At the point $(1, 1)$, the gradient is:

$\nabla$ f(1, 1) = \langle 2 $\cdot 1$, $2 \cdot 1$ \rangle = \langle 2, 2 \rangle

This means that at the point $(1, 1)$, the direction of the steepest ascent is in the direction $\langle 2, 2 \rangle$. We can also find the magnitude of the gradient:

|$\nabla$ f(1, 1)| = $\sqrt{2^2 + 2^2}$ = $\sqrt{8}$ = $2\sqrt{2}$

So if you walk in the direction of the gradient, you’ll climb at a rate of $2\sqrt{2}$ units per unit of distance.

Calculating the Directional Derivative with the Gradient

Here’s the cool part: once you have the gradient, calculating the directional derivative becomes super easy. The directional derivative of $f$ at $(x_0, y_0)$ in the direction of a unit vector $\mathbf{u}$ is simply the dot product of the gradient and the unit vector:

D_{$\mathbf{u}$} f(x_0, y_0) = $\nabla$ f(x_0, y_0) $\cdot$ $\mathbf{u}$

This means that to find the directional derivative, all you need to do is:

  1. Find the gradient $\nabla f(x_0, y_0)$.
  2. Take the dot product with the unit vector $\mathbf{u}$.

Example: Back to Our Paraboloid

Let’s go back to our example $f(x, y) = x^2 + y^2$ at the point $(1, 1)$, and find the directional derivative in the direction $\mathbf{u} = \langle \frac{\sqrt{2}}{2}, \frac{\sqrt{2}}{2} \rangle$.

We already know that the gradient at $(1, 1)$ is $\nabla f(1, 1) = \langle 2, 2 \rangle$.

Now let’s take the dot product:

D_{$\mathbf{u}$} f(1, 1) = \langle 2, 2 \rangle $\cdot$ \langle $\frac{\sqrt{2}}{2}$, $\frac{\sqrt{2}}{2}$ \rangle

= $2 \cdot$ $\frac{\sqrt{2}}{2}$ + $2 \cdot$ $\frac{\sqrt{2}}{2}$ = $\sqrt{2}$ + $\sqrt{2}$ = $2\sqrt{2}$

So the directional derivative in that direction is $2\sqrt{2}$. That’s exactly the same as the magnitude of the gradient, which makes sense because our direction $\mathbf{u}$ is the same direction as the gradient vector!

A Real-World Example: Temperature in a Room

Let’s apply this to a real-world scenario. Imagine you’re in a room where the temperature at any point $(x, y)$ is given by $T(x, y) = 20 - 4x^2 - 3y^2$. This function describes how the temperature changes depending on where you are in the room.

Step 1: Find the Gradient

First, we find the gradient of $T(x, y)$.

$\frac{\partial T}{\partial x}(x, y) = -8x$

$\frac{\partial T}{\partial y}(x, y) = -6y$

So the gradient is:

$\nabla$ T(x, y) = \langle -8x, -6y \rangle

Step 2: Evaluate the Gradient at a Point

Let’s say you’re standing at the point $(1, 2)$ in the room. What’s the gradient there?

$\nabla$ T(1, 2) = \langle -$8 \cdot 1$, -$6 \cdot 2$ \rangle = \langle -8, -12 \rangle

This tells us that the direction of the steepest temperature decrease is toward $(-8, -12)$. In other words, if you move in that direction, the temperature will drop the fastest. The magnitude of this gradient:

|$\nabla$ T(1, 2)| = $\sqrt{(-8)^2 + (-12)^2}$ = $\sqrt{64 + 144}$ = $\sqrt{208}$ $\approx 14$.42

So, the temperature is decreasing at a rate of about $14.42$ degrees per unit of distance in that direction.

Step 3: Find the Directional Derivative in Another Direction

What if you want to know how fast the temperature changes if you walk straight east, along the $x$-axis? That direction is $\mathbf{u} = \langle 1, 0 \rangle$.

The directional derivative is:

D_{$\mathbf{u}$} T(1, 2) = $\nabla$ T(1, 2) $\cdot$ \langle 1, 0 \rangle = \langle -8, -12 \rangle $\cdot$ \langle 1, 0 \rangle = -8

So if you walk east, the temperature decreases at a rate of $8$ degrees per unit of distance.

Maximum and Minimum Directional Derivatives

One of the most important properties of the gradient is that it tells us not only the direction of the steepest ascent but also the maximum possible directional derivative. The maximum directional derivative at a point is the magnitude of the gradient:

$\max_{\mathbf{u}$} D_{$\mathbf{u}$} f(x_0, y_0) = |$\nabla f(x_0, y_0)|

And this maximum occurs in the direction of the gradient vector itself.

Conversely, the minimum directional derivative (the steepest descent) is the negative of the magnitude of the gradient, and it occurs in the opposite direction of the gradient.

Example: Revisiting Our Temperature Function

Let’s revisit our temperature function $T(x, y) = 20 - 4x^2 - 3y^2$ at the point $(1, 2)$. We found that the gradient is $\langle -8, -12 \rangle$ and its magnitude is about $14.42$.

  • The maximum directional derivative at $(1, 2)$ is $14.42$, and it occurs in the direction of $\langle -8, -12 \rangle$.
  • The minimum directional derivative at $(1, 2)$ is $-14.42$, and it occurs in the opposite direction of $\langle -8, -12 \rangle$.

So if you want to cool down as fast as possible, you should walk exactly in the direction of the gradient!

Gradient in Three Dimensions

So far, we’ve been working in two dimensions, with functions $f(x, y)$. But what if we have a function of three variables, $f(x, y, z)$? The concept is exactly the same!

The gradient in three dimensions is:

$\nabla$ f(x, y, z) = $\left$\langle \frac{\partial f}{\partial x}(x, y, z), \frac{\partial f}{\partial y}(x, y, z), \frac{\partial f}{\partial z}(x, y, z) $\right$\rangle

And the directional derivative is still the dot product of the gradient and the unit vector in the desired direction.

Example: A 3D Function

Let’s consider the function $f(x, y, z) = x^2 + y^2 + z^2$. This describes a 3D paraboloid (a sphere-like shape).

The gradient is:

$\nabla$ f(x, y, z) = \langle 2x, 2y, 2z \rangle

At the point $(1, 1, 1)$, the gradient is:

$\nabla$ f(1, 1, 1) = \langle 2 $\cdot 1$, $2 \cdot 1$, $2 \cdot 1$ \rangle = \langle 2, 2, 2 \rangle

The magnitude of this gradient is:

|$\nabla$ f(1, 1, 1)| = $\sqrt{2^2 + 2^2 + 2^2}$ = $\sqrt{12}$ = $2\sqrt{3}$

So in three dimensions, the same principles apply: the gradient points toward the steepest ascent, and the magnitude of the gradient tells us the maximum rate of change.

Why the Gradient Matters

Why is the gradient so important? Here are a few key reasons:

  1. Optimization: In calculus, we often want to find the maximum or minimum values of a function. The gradient helps us do this. If we’re trying to climb a hill (maximize a function), we follow the gradient. If we’re trying to find the lowest point (minimize a function), we go in the opposite direction.
  2. Physics: In physics, the gradient of a scalar field (like temperature or potential energy) tells us the direction of the force. For example, if you have an electric potential field, the electric field is the negative gradient of the potential.
  3. Machine Learning: In machine learning, gradients are used in optimization algorithms like gradient descent. This is how computers learn to adjust parameters to minimize error and improve their predictions.

Conclusion

In this lesson, students, we explored the concepts of directional derivatives and the gradient vector. We learned that:

  • The directional derivative tells us how fast a function changes in any direction.
  • The gradient is a vector that points in the direction of the steepest ascent and gives us the maximum rate of change.
  • We can calculate the directional derivative by taking the dot product of the gradient and a unit direction vector.
  • The gradient is an essential tool in optimization, physics, and machine learning.

Understanding these concepts will give you a solid foundation for tackling real-world problems where rates of change matter. Keep exploring, and you’ll soon see gradients everywhere! 🌟

Study Notes

  • Directional Derivative Definition:

D_{$\mathbf{u}$} f(x_0, y_0) = $\lim_{t \to 0}$ $\frac{f(x_0 + t u_1, y_0 + t u_2) - f(x_0, y_0)}{t}$

  • Gradient Vector:

$\nabla$ f(x, y) = $\left$\langle \frac{\partial f}{\partial x}(x, y), \frac{\partial f}{\partial y}(x, y) $\right$\rangle

  • Gradient in 3D:

$\nabla$ f(x, y, z) = $\left$\langle \frac{\partial f}{\partial x}(x, y, z), \frac{\partial f}{\partial y}(x, y, z), \frac{\partial f}{\partial z}(x, y, z) $\right$\rangle

  • Directional Derivative and Gradient Relationship:

D_{$\mathbf{u}$} f(x_0, y_0) = $\nabla$ f(x_0, y_0) $\cdot$ $\mathbf{u}$

  • Maximum Directional Derivative:

$\max_{\mathbf{u}$} D_{$\mathbf{u}$} f(x_0, y_0) = |$\nabla f(x_0, y_0)|

  • Minimum Directional Derivative:

$\min_{\mathbf{u}$} D_{$\mathbf{u}$} f(x_0, y_0) = -|$\nabla f(x_0, y_0)|

  • Unit Vector: A vector $\mathbf{u} = \langle u_1, u_2 \rangle$ is a unit vector if $\sqrt{u_1^2 + u_2^2} = 1$.
  • Gradient Points Toward Steepest Ascent: The gradient vector $\nabla f(x, y)$ points in the direction where $f$ increases the fastest.
  • Gradient Magnitude: The magnitude $|\nabla f(x, y)|$ gives the steepest rate of increase.
  • Dot Product: For two vectors $\mathbf{a} = \langle a_1, a_2 \rangle$ and $\mathbf{b} = \langle b_1, b_2 \rangle$, the dot product is:

$\mathbf{a}$ $\cdot$ $\mathbf{b}$ = a_1 b_1 + a_2 b_2

  • Real-World Applications:
  • Optimization problems (finding maxima/minima)
  • Physics (forces from potential fields)
  • Machine learning (gradient descent algorithms)

Practice Quiz

5 questions to test your understanding

Directional Derivatives And Gradient — High School Calculus 3 | A-Warded