If you're seeing this message, it means we're having trouble loading external resources on our website.

Jeżeli jesteś za filtrem sieci web, prosimy, upewnij się, że domeny *.kastatic.org i *.kasandbox.org są odblokowane.

Główna zawartość

Dokładniejsze zrozumienie pochodnych kierunkowych

A more thorough look at the formula for directional derivatives, along with an explanation for why the gradient gives the slope of steepest ascent.

Background:

This article is targetted for those who want a deeper understanding of the directional derivative and its formula.

Formal definition of the directional derivative

There are a couple reasons you might care about a formal definition. For one thing, really understanding the formal definition of a new concept can make clear what it is really going on. But more importantly than that, I think the main benefit is that it gives you the confidence to recognize when such a concept can and cannot be applied.
As a warm up, let's review the formal definition of the partial derivative, say with respect to x:
start fraction, \partial, f, divided by, start color #0c7f99, \partial, x, end color #0c7f99, end fraction, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, equals, limit, start subscript, h, \to, 0, end subscript, start fraction, f, left parenthesis, x, start subscript, 0, end subscript, start color #0c7f99, plus, h, end color #0c7f99, comma, y, start subscript, 0, end subscript, right parenthesis, minus, f, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, divided by, start color #0c7f99, h, end color #0c7f99, end fraction
The connection between the informal way to read start fraction, \partial, f, divided by, \partial, x, end fraction and the formal way to read the right-hand side is as follows:
SymbolInformal understandingFormal understanding
\partial, xA tiny nudge in the x direction.A limiting variable h which goes to 0, and will be added to the first component of the function's input.
\partial, fThe resulting change in the output of f after the nudge.The difference between f, left parenthesis, x, start subscript, 0, end subscript, plus, h, comma, y, start subscript, 0, end subscript, right parenthesis and f, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, taken in the same limit as h, \to, 0.
We could instead write this in vector notation, viewing the input point left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis as a two-dimensional vector
x0=[x0y0]\begin{aligned} \textbf{x}_0 = \left[ \begin{array}{c} x_0 \\\\ y_0 \\\\ \end{array} \right] \end{aligned}
Here start bold text, x, end bold text, start subscript, 0, end subscript is written in bold to emphasize its vectoriness. It's a bit confusing to use a bold start bold text, x, end bold text for the entire input rather than some other letter, since the letter x is already used in an un-bolded form to denote the first component of the input. But hey, that's convention, so we go with it.
Instead of writing the "nudged" input as left parenthesis, x, start subscript, 0, end subscript, plus, h, comma, y, start subscript, 0, end subscript, right parenthesis, we write it as start bold text, x, end bold text, start subscript, 0, end subscript, plus, h, start bold text, i, end bold text, with, hat, on top, where start bold text, i, end bold text, with, hat, on top is the unit vector in the x-direction:
fx(x0)=limh0f(x0+hi^)f(x0)h\begin{aligned} \dfrac{\partial f}{\partial x}(\textbf{x}_0) = \lim_{h \to 0} \dfrac{f(\textbf{x}_0 + h \hat{\textbf{i}}) - f(\textbf{x}_0)}{h} \end{aligned}
In this notation, it's much easier to see how to generalize the partial derivative with respect to x to the directional derivative along any vector start bold text, v, end bold text, with, vector, on top:
start color #0c7f99, del, start subscript, start color #e84d39, start bold text, v, end bold text, with, vector, on top, end color #e84d39, end subscript, f, left parenthesis, start bold text, x, end bold text, start subscript, 0, end subscript, right parenthesis, equals, limit, start subscript, h, \to, 0, end subscript, start fraction, f, left parenthesis, start bold text, x, end bold text, start subscript, 0, end subscript, plus, h, start color #e84d39, start bold text, v, end bold text, with, vector, on top, end color #e84d39, right parenthesis, minus, f, left parenthesis, start bold text, x, end bold text, start subscript, 0, end subscript, right parenthesis, divided by, h, end fraction, end color #0c7f99
In this case, adding h, start bold text, v, end bold text, with, vector, on top to the input for a limiting variable h, \to, 0 formalizes the idea of a tiny nudge in the direction of start bold text, v, end bold text, with, vector, on top.
Showing directional derivative nudge

Seeking connection between the definition and computation

Computing the directional derivative involves a dot product between the gradient del, f and the vector start bold text, v, end bold text, with, vector, on top. For example, in two dimensions, here's what this would look like:
vf(x,y)=fv=[fxfy][v1v2]=v1fx(x,y)+v2fy(x,y)\begin{aligned} \nabla_{\vec{\textbf{v}}} f(x, y) &= \nabla f \cdot \vec{\textbf{v}} \\\\ &= \left[ \begin{array}{c} \dfrac{\partial f}{\partial x} \\\\ \dfrac{\partial f}{\partial y} \end{array} \right] \cdot \left[ \begin{array}{c} \blueE{v_1} \\\\ \greenE{v_2} \end{array} \right] \\\\ &= \blueE{v_1} \dfrac{\partial f}{\partial x}(x, y) + \greenE{v_2} \dfrac{\partial f}{\partial y}(x, y) \end{aligned}
Here, start color #0c7f99, v, start subscript, 1, end subscript, end color #0c7f99 and start color #0d923f, v, start subscript, 2, end subscript, end color #0d923f are the components of start bold text, v, end bold text, with, vector, on top.
v=[v1v2]\begin{aligned} \vec{\textbf{v}} = \left[ \begin{array}{c} \blueE{v_1} \\ \\ \greenE{v_2} \\\\ \end{array} \right] \end{aligned}
The central question is, what does this formula have to do with the definition given above?

Breaking down the nudge

The computation for del, start subscript, start bold text, v, end bold text, end subscript, f can be seen as a way to break down a tiny step in the direction of start bold text, v, end bold text into its x and y components.
Break apart a step along the vector h, start bold text, v, end bold text, with, vector, on top
Specifically, you can imagine the following procedure:
  1. Start at some point left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis.
  2. Choose a tiny value h.
  3. Add h, start color #0c7f99, v, start subscript, 1, end subscript, end color #0c7f99 to x, start subscript, 0, end subscript, which means stepping to the point left parenthesis, x, start subscript, 0, end subscript, plus, h, start color #0c7f99, v, start subscript, 1, end subscript, end color #0c7f99, comma, y, start subscript, 0, end subscript, right parenthesis. From what we know of partial derivatives, this will change the output of the function by about
hv1(fx(x0,y0))\begin{aligned} h\blueE{v_1} \left(\dfrac{\partial f}{\partial x}(x_0, y_0) \right) \end{aligned}
  • Now add h, start color #0d923f, v, start subscript, 2, end subscript, end color #0d923f to y, start subscript, 0, end subscript to bring us up/down to the point left parenthesis, x, start subscript, 0, end subscript, plus, h, start color #0c7f99, v, start subscript, 1, end subscript, end color #0c7f99, comma, y, start subscript, 0, end subscript, plus, h, start color #0d923f, v, start subscript, 2, end subscript, end color #0d923f, right parenthesis. The resulting change to f is now about
hv2(fy(x0+hv1,y0))\begin{aligned} h\greenE{v_2}\left( \dfrac{\partial f}{\partial y}(x_0 + h\blueE{v_1}, y_0) \right) \end{aligned}
Adding the results of steps 3 and 4, the total change to the function upon moving from the input left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis to the input left parenthesis, x, start subscript, 0, end subscript, plus, h, start color #0c7f99, v, start subscript, 1, end subscript, end color #0c7f99, comma, y, start subscript, 0, end subscript, plus, h, start color #0d923f, v, start subscript, 2, end subscript, end color #0d923f, right parenthesis has been about
hv1(fx(x0,y0))+hv2(fy(x0+hv1,y0))\begin{aligned} h\blueE{v_1} \left(\dfrac{\partial f}{\partial x}(x_0, y_0) \right) + h\greenE{v_2}\left( \dfrac{\partial f}{\partial y}(x_0 \redD{+ h\blueE{v_1}}, y_0) \right) \end{aligned}
This is very close to the expression for the directional derivative, which says the change in f due to this step h, start bold text, v, end bold text, with, vector, on top should be about
=hvf(x0,y0)=hvf(x0,y0)=hv1fx(x0,y0)+hv2fy(x0,y0)\begin{aligned} &\phantom{=}h \nabla_{\vec{\textbf{v}}} f(x_0, y_0) \\\\ &= h \vec{\textbf{v}} \cdot \nabla f(x_0, y_0)\\\\ &= h\blueE{v_1}\dfrac{\partial f}{\partial x}(x_0, y_0) + h\greenE{v_2}\dfrac{\partial f}{\partial y}(x_0, y_0) \end{aligned}
However, this differs slightly from the result of our step-by-step argument, in which the partial derivative with respect to y is taken at the point left parenthesis, x, start subscript, 0, end subscript, plus, h, start color #0c7f99, v, start subscript, 1, end subscript, end color #0c7f99, comma, y, start subscript, 0, end subscript, right parenthesis, not at the point left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis.
Luckily we are considering very, very small values of h. In fact, more technically, we should be talking about the limit as h, \to, 0. Therefore evaluating start fraction, \partial, f, divided by, \partial, y, end fraction at left parenthesis, x, start subscript, 0, end subscript, plus, h, start color #0c7f99, v, start subscript, 1, end subscript, end color #0c7f99, comma, y, start subscript, 0, end subscript, right parenthesis will be almost the same as evaluating it at left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis. Moreover, as h approaches 0, so does the difference between these two, but we have to assume that f is continuous.

Why does the gradient point in the direction of steepest ascent?

Having learned about the directional derivatives, we can now understand why the direction of the gradient is the direction of steepest ascent.
Pojęcie kierunku najszybszego wzrostu.
Specifically, here's the question at hand.
Setup:
  • Let f be some scalar-valued multivariable function, such as f, left parenthesis, x, comma, y, right parenthesis, equals, x, squared, plus, y, squared.
  • Let left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis be a particular input point
  • Consider all possible directions, i.e. all unit vectors start bold text, u, end bold text, with, hat, on top in the input space of f.
Question (informal): If we start at left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis, which direction should we walk so that the output of f increases most quickly?
Question (formal): Which unit vector start bold text, u, end bold text, with, hat, on top maximizes the directional derivative along start bold text, u, end bold text, with, hat, on top?
u^f(x0,y0)=u^f(x0,y0)Maximize this quantity\begin{aligned} \nabla_{\hat{\textbf{u}}} f(x_0, y_0) = \underbrace{\hat{\textbf{u}} \cdot \nabla f(x_0, y_0)}_{ \text{Maximize this quantity} } \end{aligned}
The famous triangle inequality tells us that this will be maximized by the unit vector in the direction del, f, left parenthesis, x, start subscript, 0, end subscript, comma, y, start subscript, 0, end subscript, right parenthesis.
Maximize dot product
Notice, the fact that the gradient points in the direction of steepest ascent is a consequence of the more fundamental fact that all directional derivatives require taking the dot product with del, f.

Chcesz dołączyć do dyskusji?

Na razie brak głosów w dyskusji
Rozumiesz angielski? Kliknij tutaj, aby zobaczyć więcej dyskusji na angielskiej wersji strony Khan Academy.