Mathematics for AI and Machine Learning

Foundations for modern AI and machine learning

Gradient Normal to a Level Set

Chapter 11 Calculus & analysis

Chapter 11: Matrix Calculus — Gradient and Directional Derivatives

From the book

Chapter 11: Matrix Calculus. In the chapter mind map this icon labels Gradient & Level Sets. The discussion below is excerpted and lightly edited from § Gradient and Directional Derivatives in Mathematics for AI and Machine Learning.

The symbol $\nabla$ (pronounced "nabla") is a vector differential operator. For a function $f : \mathbb{R}^N \to \mathbb{R}$, the operator $\nabla_{\mathbf{x}}$ measures the rate of change (slope) of $f$ in each coordinate direction separately, and then synthesizes these partial derivatives into a single vector. This resulting vector is the gradient.

Formally, for $\mathbf{x} \in \mathbb{R}^N$ and $f : \mathbb{R}^N \to \mathbb{R}$, the gradient is defined as:

For matrix-valued inputs, if $X \in \mathbb{R}^{M \times N}$ and $f : \mathbb{R}^{M \times N} \to \mathbb{R}$, the gradient is:

Both $\nabla_{\mathbf{x}} f(\mathbf{x})$ and $\nabla_{\mathbf{x}} f$ are commonly used notations for the gradient. The form $\nabla_{\mathbf{x}} f(\mathbf{x})$ explicitly indicates that the gradient is evaluated at the point $\mathbf{x}$, while $\nabla_{\mathbf{x}} f$ emphasizes that the gradient is an operator acting on the function $f$. Both notations are equivalent and acceptable; the choice is often a matter of style or emphasis.

What this drawing shows

What you see. Green level-set contour fixed; a blue sample point travels along it while the gray tangent and red gradient $\nabla f$ (normal to the contour) update, showing steepest-ascent direction.

In the mind map. Chapter 11 — Gradient & Level Sets. See From the book above for definitions, figures, and worked examples.

Where to read next

Open Chapter 11 companion →

Read the full definitions, figures, and worked examples in Chapter 11: Matrix Calculus — see the mind-map node Gradient & Level Sets.

PNG Icons

Textless (256×256 px)
PNG 256×256 px Copy PNG URL
Textless (64×64 px)
PNG 64×64 px Copy PNG URL
Textless (32×32 px)
PNG 32×32 px Copy PNG URL

Animated GIFs

Animated GIF (256×256 px)
GIF 256×256 px Copy GIF URL
Animated GIF (128×128 px)
GIF 128×128 px Copy GIF URL
Animated GIF (64×64 px)
GIF 64×64 px Copy GIF URL