From a Direction to a Rate of Change
A directional derivative measures how a function changes as its input moves from a point in a specified direction. The direction determines the path; the function determines how its value changes along that path.
The key idea is to turn the multivariable question into a one-variable question. Through a point \(\mathbf{a}\), a direction vector \(\mathbf{u}\) specifies the line \(\mathbf{a}+t\mathbf{u}\). Composing the function with this line gives a one-variable function, to which the chain rule applies.
When \(\mathbf{u}\) is a unit vector and \(f\) is differentiable, the resulting rate is the dot product of the gradient of \(f\) at \(\mathbf{a}\) with \(\mathbf{u}\). The derivation also explains why the unit-length condition matters: it makes the line parameter measure distance traveled.
Directional Derivative and Gradient
Let \(f\) be a real-valued function of \(n\) variables, and let \(\mathbf{a}\) be a point in its domain. A vector \(\mathbf{u}\) is a unit direction if its length is \(1\). The directional derivative in that direction is the two-sided limit of the change in \(f\), divided by the change in the line parameter.
The limit uses both positive and negative values of \(t\). Thus, it describes the derivative of the function along the line, with the line parameter increasing in the direction \(\mathbf{u}\). If \(f\) is defined on an open neighborhood of \(\mathbf{a}\), then points \(\mathbf{a}+t\mathbf{u}\) remain in its domain for all sufficiently small \(t\).
When the first partial derivatives exist, the gradient is the vector whose components are those partial derivatives:
Having partial derivatives alone is not enough to apply the result derived below. The required condition is that \(f\) be differentiable at \(\mathbf{a}\). Differentiability guarantees that the linear approximation to \(f\) at that point describes its local change, and it permits the multivariable chain rule used in the derivation.
Deriving the Formula with the Chain Rule
Fix a point \(\mathbf{a}\) and a unit vector \(\mathbf{u}\). Define a one-variable function \(g\) by evaluating \(f\) along the line through \(\mathbf{a}\):
At \(t=0\), the point on the line is \(\mathbf{a}\), so \(g(0)=f(\mathbf{a})\). Consequently, the definition of the directional derivative is exactly the ordinary derivative of \(g\) at zero, whenever that derivative exists.
To apply the chain rule, write \(\mathbf{a}=(a_1,\dots,a_n)\) and \(\mathbf{u}=(u_1,\dots,u_n)\). The coordinates of the moving point are \(x_i(t)=a_i+tu_i\), so \(x_i'(t)=u_i\). The chain rule gives the derivative of \(f\) along the line as the sum of its coordinate rates of change multiplied by the rates of the corresponding coordinates.
Here is the complete chain-rule argument. Because \(f\) is differentiable at \(\mathbf{a}\), the composition \(g(t)=f(\mathbf{a}+t\mathbf{u})\) is differentiable at \(t=0\). Applying the chain rule coordinate by coordinate gives
The last equality is the definition of the dot product. The formula is therefore not a separate rule to memorize without explanation: it follows by differentiating the function along the line and applying the chain rule.
Worked Examples
Worked Example: A Directional Derivative in Two Variables
Let \(f(x,y)=x^2+3xy+y^2\). Find the directional derivative at \(\mathbf{a}=(1,-1)\) in the unit direction \(\mathbf{u}=(3/5,4/5)\), and check it directly along the line.
First, the partial derivatives are \(f_x=2x+3y\) and \(f_y=3x+2y\). Evaluating at the point gives \(f_x(1,-1)=2-3=-1\) and \(f_y(1,-1)=3-2=1\). Thus \(\nabla f(1,-1)=(-1,1)\). The direction is a unit vector because \(\sqrt{(3/5)^2+(4/5)^2}=\sqrt{9/25+16/25}=1\). The formula gives
For a direct check, points on the line are \(x=1+3t/5\) and \(y=-1+4t/5\). Substituting into \(f\), the three terms are
Adding gives \(f(\mathbf{a}+t\mathbf{u})=-1+t/5+61t^2/25\), while \(f(\mathbf{a})=-1\). Therefore
Taking \(t\to0\) gives \(1/5\), agreeing with the gradient formula.
Worked Example: A Directional Derivative in Three Variables
Let \(f(x,y,z)=xe^y+yz^2\). Find the directional derivative at \(\mathbf{a}=(1,0,1)\) in the direction \(\mathbf{u}=(2/3,-1/3,2/3)\). Then verify the result by differentiating the function restricted to the line.
The vector is a unit vector since its squared length is \(4/9+1/9+4/9=1\). The partial derivatives are \(f_x=e^y\), \(f_y=xe^y+z^2\), and \(f_z=2yz\). At \((1,0,1)\), these equal \(1\), \(2\), and \(0\), respectively. Hence the gradient formula gives
To check, the line has coordinates \(x=1+2t/3\), \(y=-t/3\), and \(z=1+2t/3\). Thus the restricted function is
Differentiate the first term using the product rule. Its derivative at zero is \((2/3)e^0+(1)(-1/3)e^0=2/3-1/3=1/3\). For the second term, the product rule gives derivative at zero \((-1/3)(1)^2+0=-1/3\), since the factor \(-t/3\) vanishes at zero. Therefore \(g'(0)=1/3-1/3=0\), as predicted.
Worked Example: Why the Direction Must Be Normalized
Let \(f(x,y)=x^2+y^2\), let \(\mathbf{a}=(1,2)\), and suppose the requested direction is described by the non-unit vector \(\mathbf{v}=(3,4)\). Find the rate per unit distance in that direction.
The length of \(\mathbf{v}\) is \(\sqrt{3^2+4^2}=5\), so the corresponding unit vector is \(\mathbf{u}=(3/5,4/5)\). The partial derivatives give \(\nabla f(x,y)=(2x,2y)\), and therefore \(\nabla f(1,2)=(2,4)\). The rate per unit distance is
Check along the unit-speed line: \(x=1+3t/5\), \(y=2+4t/5\). Substitution gives \(f(\mathbf{a}+t\mathbf{u})=5+22t/5+t^2\). Since \(f(\mathbf{a})=5\), the difference quotient is \(22/5+t\), whose limit is \(22/5\).
If we instead use \(\mathbf{v}\) without normalizing, the parameterized line is \((1+3t,2+4t)\), and the derivative with respect to \(t\) at zero is \((2,4)\cdot(3,4)=22\). This is five times the rate per unit distance because this parameterization travels at speed \(5\). The unnormalized dot product gives a rate per unit parameter, not per unit distance.
What the Unit-Vector Condition Does
The chain-rule calculation itself works for any vector \(\mathbf{v}\): differentiating \(f(\mathbf{a}+t\mathbf{v})\) at zero gives \(\nabla f(\mathbf{a})\cdot\mathbf{v}\), provided \(f\) is differentiable. But if \(\mathbf{v}\) is not a unit vector, the parameter \(t\) does not measure distance along the line at unit speed. The definition of a directional derivative per unit distance therefore uses a unit vector.
If \(\mathbf{v}\ne\mathbf{0}\), its unit direction is \(\mathbf{v}/\|\mathbf{v}\|\). The rate per unit distance in that direction is consequently \(\nabla f(\mathbf{a})\cdot\bigl(\mathbf{v}/\|\mathbf{v}\|\bigr)\). A zero vector has no direction and cannot be normalized.
A Common Mistake: Using the Formula Without Its Conditions
A frequent error is to take a vector that is not a unit vector and treat its dot product with the gradient as the rate per unit distance. For example, in the preceding example, the calculation \((2,4)\cdot(3,4)=22\) is a valid derivative with respect to the parameter \(t\) in the line \((1+3t,2+4t)\). It is not the rate per unit distance. Since the line moves \(5\) units when \(t\) increases by \(1\), divide by \(5\), or normalize first:
A second condition matters just as much: the theorem assumes differentiability at the point. Partial derivatives at a point, by themselves, do not justify using this chain-rule conclusion. Before applying the formula, check that the function is differentiable there and that the direction vector has length \(1\).
Why This Formula Is Useful
The formula converts a rate along a line into a calculation using the gradient at a single point and the chosen direction. Its derivation clarifies what each part contributes: the gradient records the coordinate derivatives, and the direction vector weights those derivatives according to how quickly each coordinate changes along the line.
It also offers a useful check on a calculation. One can either differentiate the one-variable function obtained by substituting the line, or use the gradient dot product. When the assumptions hold, both methods must give the same value. The direct line calculation in the examples confirms the formula without replacing the reason it works: the chain rule.
Check Your Understanding
Use the definition and derivation in this tutorial to answer the following questions.
- How is the directional derivative at \(\mathbf{a}\) related to the derivative of \(g(t)=f(\mathbf{a}+t\mathbf{u})\) at \(t=0\)?
- State the differentiability and direction-length conditions in the gradient formula.
- For \(f(x,y)=x^2+y^2\), find the directional derivative at \((1,0)\) in the unit direction \((0,1)\).
- If a nonzero direction vector has length \(4\), what must you do before interpreting its dot product with the gradient as a rate per unit distance?
- Why does differentiability at the point matter in the chain-rule derivation?