Skip to main content

The Gradient and Local Prediction

Which unit input direction increases Q fastest near (1, 1)? This chapter represents the scalar derivative by a gradient and checks the prediction against the exact output.

  • Gradient: The vector of partial derivatives that represents the linear part of local change for a differentiable scalar function.

Package the partial derivatives​

With standard Euclidean coordinates, the gradient of a differentiable scalar function is the column vector of partial derivatives. It represents the derivative by a dot product:

Df(a)h=∇f(a)Th,f(a+h)=f(a)+∇f(a)Th+o(∥h∥).Df(a)h=\nabla f(a)^Th,\qquad f(a+h)=f(a)+\nabla f(a)^Th+o(\|h\|).

For QQ, ∇Q(a)=(3,3)T\nabla Q(a)=(3,3)^T. With h=(0.1,−0.05)Th=(0.1,-0.05)^T, the linear change is 0.150.15, giving prediction 3.153.15. The exact output is 3.15753.1575, so the error is 0.00750.0075.

A gradient normal to an elliptical level set and a tangent direction with zero linear response
The gradient identifies the fastest Euclidean increase and normals to regular level sets.

Choose the fastest unit direction​

Cauchy–Schwarz gives ∇f(a)Tu≤∥∇f(a)∥\nabla f(a)^Tu\le\|\nabla f(a)\| for ∥u∥=1\|u\|=1. For a nonzero gradient, equality occurs at u=∇f(a)/∥∇f(a)∥u=\nabla f(a)/\|\nabla f(a)\|. Here the maximum rate is 323\sqrt2, attained along (1,1)/2(1,1)/\sqrt2. The negative direction gives the fastest decrease. If the gradient is zero, every first-order directional derivative is zero and higher-order terms decide the behavior.

Relate the gradient to level sets​

If a differentiable curve stays in a level set, differentiating f(r(t))=cf(r(t))=c gives ∇f(r(t))Tr′(t)=0\nabla f(r(t))^Tr'(t)=0. At a regular point where the gradient is nonzero, the gradient is normal to the level set. For Q=3Q=3 at aa, a tangent direction is (1,−1)(1,-1).

The derivative is a linear functional independently of coordinates. Its gradient representation uses an inner product. Changing units or weights changes what a unit direction means; in a weighted metric with matrix GG, the gradient vector is G−1G^{-1} times the Euclidean gradient. Do not compare raw rates from incompatible input units without a stated scaling.

Basic practice​

Prepare​

Reuse Q, a, h and the directional results. Use the Euclidean inner product and dimensionless coordinates.

Record assumed inputs, predictions, and exact calculations separately. If you use software, label rounded outputs; no physical measurement is implied.

Predict​

Will the tangent-plane prediction be exact for a quadratic?

Execute​

  1. Compute the gradient and its unit direction at a.
  2. Calculate the predicted and exact output at a + h.
  3. Check that (1, -1) is perpendicular to the gradient and find its first-order response.

Observe and record​

Case or quantityPredictionExact result or argumentError or software check
Gradient and fastest direction
Prediction versus exact output
Level tangent direction

Check after working: The gradient is (3, 3), maximum unit rate is 3√2, prediction is 3.15, and exact output is 3.1575. The tangent direction has zero dot product but can still have a quadratic change.

Optional extension​

Recompute the steepest direction when input lengths use diag(1, 4) as a metric. Explain which notion of a unit vector changed.

Keep and continue​

Keep the gradient prediction and residual. Next, represent derivatives of vector-valued functions by matrices.

Previous: Partial and Directional Derivatives

Next: The Jacobian and Total Derivative