# Gradients and Directional Derivatives: A Closed Curve Perspective

A gentle introduction to the fundamentals of nonlinear dynamics and controls

Let us define the state vector $$x = \begin{bmatrix}q \\ \dot{q}\end{bmatrix}$$

Gradient Vectors at multiple points on the level curve $$V(x)=<x,x>=r^2$$ which is a closed curve.

The gradient is defined as the vector of partial derivatives of a function with respect to each of its independent variables. The gradient of a scalar function $$V(x)$$ is denoted as $$\nabla V(x)$$ and is defined as:

$\nabla V(x) = \begin{bmatrix}\frac{\partial V(x)}{\partial q} \\ \frac{\partial V(x)}{\partial \dot{q}}\end{bmatrix}$

note that upon plotting the gradient vectors at multiple points on the curve $$V(x)=<x,x>=r^2$$, we get a vector field that points in the direction of the steepest ascent of the closed curve $$V(x)=r^2$$.

Notice the gradient vector is orthogonal to the red level curve of the function $$V(x)=r^2$$ with $$r=3$$.

This is because the gradient vector is orthogonal to the level curve of the function $$V(x)$$ at a point $$x$$.

Gradient Vectors at multiple points on the level curve $$V(x)=<kx,kx>=1$$

where $$k = \begin{bmatrix}1/a \\ 1/b \end{bmatrix}$$

let us now conder the dynamics of a nonlinear system given by:

$\dot{x} = f(x)$

where $$x \in \mathbb{R}^n$$ and $$f(x) \in \mathbb{R}^n$$

The directional derivative of $$V(x)$$ along the trajectory of the system is given by:

$\frac{dV(x)}{dt} = \frac{\partial V(x)}{\partial x} \frac{dx}{dt} = \nabla V(x)^T f(x)$

The directional derivative of $$V(x)$$ along the trajectory of the system is the dot product of the gradient of $$V(x)$$ and the vector field $$f(x)$$

$(or)$

The directional derivative of $$V(x)$$ along the trajectory of the system is the rate of change of $$V(x)$$ along the trajectory of the system.

A key idea arises from the fact that the gradient at each point on the curve $$V(x)$$ is orthogonal to the level curve but when taken an inner product with the vector field $$f(x)$$ resolves into a scalar that indicates how aligned the gradient vector is with the vector field $$f(x)$$ at that point.

if the scalar is positive, $$\frac{dV(x)}{dt} > 0$$ then the gradient vector is aligned with the vector field $$f(x)$$ and hence the curve $$V(x)$$ is expanding in the direction of the vector field $$f(x)$$.

if the scalar is negative, $$\frac{dV(x)}{dt} < 0$$ then the gradient vector is anti-aligned with the vector field $$f(x)$$ and hence the curve $$V(x)$$ is squishing in the direction of the vector field $$f(x)$$.

if the scalar is zero, $$\frac{dV(x)}{dt} = 0$$ then the gradient vector is orthogonal to the vector field $$f(x)$$ and hence the curve $$V(x)$$ is neither expanding nor squishing in the direction of the vector field $$f(x)$$.

KEY-IDEA: Think of it as a measure that indicates the rate of squish/expansion of the curve $$V(x)$$ in the directions of the vector field $$f(x)$$.