Steepest Ascent Method

The steepest ascent method finds a local maximum of f(x,y)f(x, y) by repeatedly moving in the direction of the gradient.

Gradient

The gradient of f(x,y)f(x,y) is

∇f(x,y)=∂f∂xi⃗+∂f∂yj⃗\nabla f(x, y) = \frac{\partial f}{\partial x}\vec{i} + \frac{\partial f}{\partial y}\vec{j}

f(x,y)f(x,y) increases fastest in the direction of ∇f\nabla f and decreases fastest in the opposite direction.

Procedure

Given a starting point (x0,y0)(x_0, y_0)

  • Evaluate the gradient ∇f(xi,yi)\nabla f(x_i, y_i)
  • Search along the gradient direction for the hih_i that maximizes
g(hi)=f(xi+hi∂f∂x(xi,yi), yi+hi∂f∂y(xi,yi))g(h_i) = f\left(x_i + h_i \frac{\partial f}{\partial x}(x_i,y_i),\ y_i + h_i \frac{\partial f}{\partial y}(x_i,y_i)\right)
  • Set g′(hi)=0g'(h_i) = 0 and solve for hih_i
  • Update
xi+1=xi+hi∂f∂x(xi,yi),yi+1=yi+hi∂f∂y(xi,yi)x_{i+1} = x_i + h_i \frac{\partial f}{\partial x}(x_i,y_i), \quad y_{i+1} = y_i + h_i \frac{\partial f}{\partial y}(x_i,y_i)
  • Repeat until convergence

Worked Example

Maximize

f(x,y)=2xy+2x−x2−2y2f(x,y) = 2xy + 2x - x^2 - 2y^2
Solution Reveal Hide

with initial guess x0=−1x_0 = -1, y0=1y_0 = 1. The partial derivatives are

∂f∂x=2y+2−2x,∂f∂y=2x−4y\frac{\partial f}{\partial x} = 2y + 2 - 2x, \quad \frac{\partial f}{\partial y} = 2x - 4y

Iteration 1

∂f∂x∣(−1,1)=6,∂f∂y∣(−1,1)=−6\left.\frac{\partial f}{\partial x}\right|_{(-1,1)} = 6, \quad \left.\frac{\partial f}{\partial y}\right|_{(-1,1)} = -6g(h0)=f(−1+6h0, 1−6h0)=−180h02+72h0−7g(h_0) = f(-1 + 6h_0,\ 1 - 6h_0) = -180h_0^2 + 72h_0 - 7g′(h0)=−360h0+72=0  ⟹  h0=0.2g'(h_0) = -360h_0 + 72 = 0 \implies h_0 = 0.2x1=−1+6(0.2)=0.2,y1=1−6(0.2)=−0.2x_1 = -1 + 6(0.2) = 0.2, \quad y_1 = 1 - 6(0.2) = -0.2

Iteration 2

∂f∂x∣(0.2,−0.2)=1.2,∂f∂y∣(0.2,−0.2)=1.2\left.\frac{\partial f}{\partial x}\right|_{(0.2,-0.2)} = 1.2, \quad \left.\frac{\partial f}{\partial y}\right|_{(0.2,-0.2)} = 1.2g(h1)=f(0.2+1.2h1, −0.2+1.2h1)=−1.44h12+2.88h1+0.2g(h_1) = f(0.2 + 1.2h_1,\ -0.2 + 1.2h_1) = -1.44h_1^2 + 2.88h_1 + 0.2g′(h1)=−2.88h1+2.88=0  ⟹  h1=1g'(h_1) = -2.88h_1 + 2.88 = 0 \implies h_1 = 1x2=0.2+1.2(1)=1.4,y2=−0.2+1.2(1)=1x_2 = 0.2 + 1.2(1) = 1.4, \quad y_2 = -0.2 + 1.2(1) = 1

Iteration 3

∂f∂x∣(1.4,1)=1.2,∂f∂y∣(1.4,1)=−1.2\left.\frac{\partial f}{\partial x}\right|_{(1.4,1)} = 1.2, \quad \left.\frac{\partial f}{\partial y}\right|_{(1.4,1)} = -1.2g(h2)=f(1.4+1.2h2, 1−1.2h2)=−7.2h22+2.88h2+1.64g(h_2) = f(1.4 + 1.2h_2,\ 1 - 1.2h_2) = -7.2h_2^2 + 2.88h_2 + 1.64g′(h2)=−14.4h2+2.88=0  ⟹  h2=0.2g'(h_2) = -14.4h_2 + 2.88 = 0 \implies h_2 = 0.2x3=1.4+1.2(0.2)=1.64,y3=1−1.2(0.2)=0.76x_3 = 1.4 + 1.2(0.2) = 1.64, \quad y_3 = 1 - 1.2(0.2) = 0.76

The iterations continue toward the maximum at (2,1)(2, 1), where f(2,1)=2f(2,1) = 2.

Wolfram Mathematica notebooks

A companion notebook for this note. Open it in Mathematica and evaluate the cells to reproduce the worked example.

The summary notebook defines every function used in this module, with documentation and no examples, as a starting point for your own problems.

Written by November 3, 2026 1 min read
Was this helpful?