Say we have a scalar-valued function $f: \mathbb R^3 \rightarrow \mathbb R$, such that: $$f(\mathbf x) = \mathbf x^T\mathbf a$$ $\mathbf x$ and $\mathbf a$ are two vectors.

The derivative of $f$ with respect to $\mathbf x$ is $\nabla f$, but the directional derivative of $f$ in $\mathbf x$ direction is $\nabla f\cdot \mathbf x$ (the dot denotes the dot product).

EDIT 1: By definition: $\dfrac{\mathrm d f}{\mathrm d \mathbf x} = \nabla f$

Based on this definition, we have: $$\dfrac{\partial f}{\partial \mathbf x} = \mathbf a$$

My question is: why there is a difference between the two ($\dfrac{\mathrm d f}{\mathrm d \mathbf x} = \nabla f$ and the directional derivative in $\mathbf x$ direction)? Thank you

  • $\begingroup$ I think the reason is that $\mathbf{x}$ may have magnitude other than $1$. $\endgroup$ Jun 27, 2016 at 4:59
  • $\begingroup$ @JustinBenfield: I did not understand what do you mean $\endgroup$ Jun 27, 2016 at 5:06
  • $\begingroup$ The length of the vector $\mathbf{x}$ will affect the dot product $\nabla f\cdot\mathbf{x}$. If $\Vert\mathbf{x}\Vert=1$, then the directional derivative and the derivative w.r.t. the vector $\mathbf{x}$ would coincide. $\endgroup$ Jun 27, 2016 at 5:09
  • 1
    $\begingroup$ @JustinBenfield: but if $\lvert \lvert \mathbf x \rvert \rvert = 1$ that does not imply that $\nabla f \cdot \mathbf x = \nabla f$ because the result will be a scalar $\endgroup$ Jun 27, 2016 at 5:12
  • $\begingroup$ Ahh right, I forgot one detail about the directional derivative: It points in the direction of steepest ascent. Hence it has a specific direction (determined by where in the domain you are), the directional derivative by contrast has both location and direction. There are a couple nice pictures at: en.wikipedia.org/wiki/Directional_derivative $\endgroup$ Jun 27, 2016 at 5:19

1 Answer 1


I think you are confusing the notions of the derivative of $f$ at a point $\mathbf{x} \in \mathbb{R}^3$ and the derivative of $f$ along a vector $\mathbf{v}$.

The gradient of $f$ at $\mathbf{x}$ denoted as $\nabla f(\mathbf{x})$ (sometimes referred to as the derivative of $f$ at $\mathbf{x}$) and the directional derivate of $f$ at $\mathbf{x}$ along a unit vector $\mathbf{v}$, sometimes denoted as $\dfrac{\partial f}{\partial \mathbf{v}}(\mathbf{x})$, are two different but related notions.

$\dfrac{\partial f}{\partial \mathbf{v}}(\mathbf{x})$ is defined as $$ \lim_{h \rightarrow 0} \frac{f(\mathbf{x} + h \mathbf{v}) - f(\mathbf{x})}{h}, $$ i.e., it is the rate of change of $f$ at $\mathbf{x}$ when walking along the line given by $\mathbf{x} + t \mathbf{v}$, $t \in \mathbb{R}$. One can show the following relation between the gradient and the directional derivative: $$ \dfrac{\partial f}{\partial \mathbf{v}}(\mathbf{x}) = \nabla f(\mathbf{x}) \cdot \mathbf{v}. $$ From this it is not hard to see that $\nabla f(\mathbf{x})$ is a vector that has the property that it points in the direction of the steepest ascent of $f$. (Can you see why?)

In your example $\nabla f(\mathbf{x}) = \mathbf{a}$, so the direction of steepest ascent of $f$ is always given by $\mathbf{a}$. If you want to compute the directional derivative along the $x_1$ axis say, then you take the unit vector $\mathbf{e}_1$ and compute $\nabla f(\mathbf{x}) \cdot \mathbf{e}_1 = a_1$.

  • $\begingroup$ thanks :), just correct the formula of the limit (replace + by - sign) $\endgroup$ Jun 27, 2016 at 14:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .