# Directional derivative

This article describes an analogue for functions of multiple variables of the following term/fact/notion for functions of one variable: derivative

## Definition at a point

### Generic definition

Suppose $f$ is a function of many variables. Consider the domain of $f$ as a subset of Euclidean space. Fix a direction in this space and a point in the domain. Then, the directional derivative at the point in the direction is the derivative of the function with respect to movement of the point along that direction, at the specific point.

### For a function of two variables

Suppose $f$ is a function of two variables $x,y$. Suppose $\langle u,v \rangle$ is a unit vector (i.e., we have $u^2 + v^2 = 1$). Suppose $(x_0,y_0)$ is a point in the domain of $f$ We define the directional derivative of $f$ at $(x_0,y_0)$ in the direction of $\langle u,v \rangle$ as follows.

Item Value
Notation $D_{\langle u,v \rangle}(f)(x_0,y_0)$ or $\nabla_{\langle u,v \rangle}(f)(x_0,y_0)$
Definition as a limit $\lim_{h \to 0} \frac{f(x_0 + uh,y_0 + vh) - f(x_0,y_0)}{h}$
Definition as an ordinary derivative $\frac{d}{dh}[f(x_0 + uh,y_0 + vh)]|_{h = 0}$

### For a function of multiple variables

Suppose $f$ is a function of variables $x_1,x_2,\dots,x_n$. Suppose $\langle u_1,u_2,\dots,u_n \rangle$ is a unit vector (i.e., we have $u_1^2 + u_2^2 + \dots + u_n^2 = 1$). Suppose $(a_1,a_2,\dots,a_n)$ is a point in the domain of $f$. The directional derivative of $f$ at $(a_1,a_2,\dots,a_n)$ in the direction of $\langle u_1,u_2,\dots,u_n \rangle$ is defined as follows.

Item Value
Notation $D_{\langle u_1,u_2,\dots,u_n \rangle}(f)(a_1,a_2,\dots,a_n)$ or $\nabla_{\langle u_1,u_2,\dots,u_n \rangle}(f)(a_1,a_2,\dots,a_n)$
Definition as a limit $\lim_{h \to 0} \frac{f(a_1 + u_1h,a_2 + u_2h, \dots, a_n + u_nh) - f(a_1,a_2,\dots,a_n)}{h}$
Definition as an ordinary derivative $\frac{d}{dh}[f(a_1 + u_1h, a_2 + u_2h, \dots, a_n + u_nh)]|_{h = 0}$

### For a function of multiple variables in vector notation

Suppose $f$ is a function of a vector variable $\overline{x} = \langle x_1,x_2,\dots,x_n \rangle$. Suppose $\overline{u}$ is a unit vector and $\overline{a}$ is a point in the domain of $f$. The directional derivative of $f$ at $\overline{a}$ in the direction of $\overline{u}$ is denoted and defined as below.

Item Value
Notation $D_{\overline{u}}(f)(\overline{a})$ or $\nabla_{\overline{u}}(f)(\overline{a})$
Definition as a limit $\lim_{h \to 0} \frac{f(\overline{a} + h\overline{u}) - f(\overline{a})}{h}$
Definition as an ordinary derivative $\frac{d}{dh}[f(\overline{a} + h\overline{u})]|_{h = 0}$

## Definition as a function

### Generic definition

Suppose $f$ is a function of many variables. Consider the domain of $f$ as a subset of Euclidean space. Fix a direction in this space. Then, the directional derivative in the direction is the function sending a point in the domain of $f$ to the derivative of the function with respect to movement of the point along that direction.

### For a function of two variables

Suppose $f$ is a function of two variables $x,y$, with domain a subset of $\R^2$. Suppose $\langle u,v \rangle$ is a unit vector (i.e., we have $u^2 + v^2 = 1$). Then, the directional derivative in the direction of $\langle u,v \rangle$ is a function with domain a subset of the domain of $f$, defined as the function that sends any point in the domain of $f$ to the directional derivative of $f$ in the direction of $\langle u,v \rangle$ at the point.

Item Value
Notation $D_{\langle u,v \rangle}(f)(x,y)$ or $\nabla_{\langle u,v \rangle}(f)(x,y)$
Definition as a limit $\lim_{h \to 0} \frac{f(x + uh,y+ vh) - f(x,y)}{h}$
Definition as a partial derivative $\frac{\partial}{\partial h}[f(x + uh,y + vh)]|_{h = 0}$. Note that we need to use a partial derivative because $x,y$ are now variable as we are not doing this at a single point.

### For a function of multiple variables

Suppose $f$ is a function of variables $x_1,x_2,\dots,x_n$. Suppose $\langle u_1,u_2,\dots,u_n \rangle$ is a unit vector (i.e., we have $u_1^2 + u_2^2 + \dots + u_n^2 = 1$). We define and denote the directional derivative as below.

Item Value
Notation $D_{\langle u_1,u_2,\dots,u_n \rangle}(f)(x_1,x_2,\dots,x_n)$ or $\nabla_{\langle u_1,u_2,\dots,u_n \rangle}(f)(x_1,x_2,\dots,x_n)$
Definition as a limit $\lim_{h \to 0} \frac{f(x_1 + u_1h,x_2 + u_2h, \dots, x_n + u_nh) - f(x_1,x_2,\dots,x_n)}{h}$
Definition as an ordinary derivative $\frac{\partial}{\partial h}[f(x_1 + u_1h, x_2 + u_2h, \dots, x_n + u_nh)]|_{h = 0}$. Note that we need to use a partial derivative because $x_1,x_2,\dots,x_n$ are now variable as we are not doing this at a single point.

### For a function of multiple variables in vector notation

Suppose $f$ is a function of a vector variable $\overline{x} = \langle x_1,x_2,\dots,x_n \rangle$. Suppose $\overline{u}$ is a unit vector. We define and denote the directional derivative of $f$ in the direction of $u$ below.

Item Value
Notation $D_{\overline{u}}(f)(\overline{x})$ or $\nabla_{\overline{u}}(f)(\overline{x})$
Definition as a limit $\lim_{h \to 0} \frac{f(\overline{x} + h\overline{u}) - f(\overline{x})}{h}$
Definition as an ordinary derivative $\frac{\partial}{\partial h}[f(\overline{x} + h\overline{u})]|_{h = 0}$. Note that we need to take the partial derivative instead of the ordinary derivative because the coordinates of $\overline{x}$ themselves are not fixed, as we are doing this at a generic rather than a fixed point.

## Graphical interpretation

### For a function of two variables

For further information, refer: graph of a function of two variables

The directional derivative $D_{\langle u,v \rangle} f(x_0,y_0)$ in the direction of a unit vector $\langle u,v \rangle$ at a point $(x_0,y_0)$ can be determined as follows: first, intersect the graph of the function with the plane $v(x - x_0) = u(y - y_0)$. This plane is perpendicular to the $xy$-plane and its intersection with the $xy$-plane is the line through $(x_0,y_0)$ in the direction of the unit vector $\langle u,v \rangle$.

This intersection can be thought of as the graph of a function of one variable, where the point $(x_0,y_0,0)$ is treated as the origin, the direction $(u,v,0)$ is the independent variable axis, and the $z$-axis direction is the dependent variable axis. Now, the directional derivative is the slope of this graph for dependent variable value of 0.

## Relation with gradient vector

Version type Statement
at a point, in vector notation (multiple variables) Suppose $f$ is a function of a vector variable $\overline{x} = \langle x_1,x_2,\dots,x_n \rangle$. Suppose $\overline{u}$ is a unit vector and $\overline{a}$ is a point in the domain of $f$. Suppose that the gradient vector of $f$ at $\overline{a}$ exists. We denote this gradient vector by $\nabla f(\overline{a})$. Then, we have the following relationship:
$D_{\overline{u}}(f)(\overline{a}) = \overline{u} \cdot (\nabla f(\overline{a}))$
The right side here is the dot product of vectors.
generic point, in vector notation (multiple variables) Suppose $f$ is a function of a vector variable $\overline{x} = \langle x_1,x_2,\dots,x_n \rangle$. Suppose $\overline{u}$ is a unit vector. We then have:
$D_{\overline{u}}(f)(\overline{x}) = \overline{u} \cdot (\nabla f(\overline{x}))$
The right side here is a dot product of vectors. The equality holds whenever the right side makes sense.
generic point, point-free notation (multiple variables) Suppose $f$ is a function of a vector variable $\overline{x} = \langle x_1,x_2,\dots,x_n \rangle$. Suppose $\overline{u}$ is a unit vector. We then have:
$D_{\overline{u}}(f) = \overline{u} \cdot (\nabla f)$
The right side here is a dot product of vector-valued functions (the constant function $\overline{u}$ and the gradient vector of $f$). The equality holds whenever the right side makes sense.

## Relation with partial derivatives

### Partial derivatives as directional derivatives

Version type Statement
Generic For a function $f$ of many variables $x_1,x_2,\dots,x_n$, the partial derivative $f_{x_i}(x_1,x_2,\dots,x_n)$ can be thought of as the directional derivative in the direction of the unit vector $\langle u_1,u_2,\dots,u_n \rangle$ where $u_i = 1$ and all other coordinates are zero.

### Directional derivative in terms of partial derivatives

If the gradient vector at a point exists, then it is a vector whose coordinates are the corresponding partial derivatives of the function. Thus, conditional to the existence of the gradient vector, we have that:

$D_{\langle u_1,u_2,\dots,u_n \rangle}(f)(x_1,x_2,\dots,x_n) = \sum_{i=1}^n u_if_{x_i}(x_1,x_2,\dots,x_n) = u_1f_{x_1}(x_1,x_2,\dots,x_n) + u_2f_{x_2}(x_1,x_2,\dots,x_n) + \dots + u_nf_{x_n}(x_1,x_2,\dots,x_n)$

In particular, for a function $f(x,y)$ of two variables and a unit vector $\langle u,v \rangle$, we have the following, assuming that the gradient vector exists (i.e., that the function is differentiable):

$D_{\langle u,v \rangle}(f)(x,y) = uf_x(x,y) + vf_y(x,y)$