Use a slope to improve a choice
When does following the downhill direction overshoot?
Entering midway? Revisit Build the largest enclosure for the preceding worked example, or start here and use the explanation below.
Start with a concrete question
Minimize the original synthetic squared-error function (x − 2)². A derivative gives its local slope; step size controls how far to move.
Try the initial inputs, then write a prediction before changing one setting. All calculations run locally on your CPU.
What do you expect?
Predict what happens when step size rises from 0.25 to 1.25.
Change one thing. Inspect what happens.
- At x=6 calculate error and slope before updating.
- Compare step sizes 0.25, 0.5, 1 and 1.25 with the same start.
- Start at the optimum x=2 and explain why no step moves it.
Your settingsMechanism
Calculation belowEvidence
Compare outcomes
Compare the current results
Every bar starts at zero and uses the same numeric scale in this chart. The upper bound automatically adjusts to the largest current value (at least 1), so compare the numbers when changing inputs. Units and quantities come from each label; different kinds of quantity are not interchangeable. Displayed values are rounded to at most six significant digits.Follow the calculation
- Step 1: slope = 2 × (6 − 2) = 8; next = 6 − 0.25 × 8 = 4.
- Step 2: slope = 2 × (4 − 2) = 4; next = 4 − 0.25 × 4 = 3.
- Step 3: slope = 2 × (3 − 2) = 2; next = 3 − 0.25 × 2 = 2.5.
A derivative measures local change. Subtracting the slope can reduce error, but an oversized step can oscillate or diverge.
Captures keep your inputs, prediction and observation. Results are recalculated from those inputs. Resetting inputs keeps your captures and challenge history.
Explain the mechanism
Use a slope to improve a choice
Minimize the original synthetic squared-error function (x − 2)². A derivative gives its local slope; step size controls how far to move.
Predict before changing inputs
Predict what happens when step size rises from 0.25 to 1.25.
Understand the mechanism
A derivative measures how the output changes for a tiny input change. For this squared error the slope is 2(x−2).
At x=6, slope 8 and step size 0.25 give next x=6−0.25×8=4. Error falls from 16 to 4.
The direction alone is insufficient. At step size 1 the distance from the optimum stays the same while its sign flips; above 1 it grows.
Calculate it yourself
Slope = 2(x−2); next x = x − step size × slope.
Guided investigation
At x=6 calculate error and slope before updating.
Compare step sizes 0.25, 0.5, 1 and 1.25 with the same start.
Start at the optimum x=2 and explain why no step moves it.
Assumptions and limitations
One convex scalar objective; real objectives can have multiple minima and noisy slopes.
Only eight updates run. Divergence here is a numerical lesson, not a training benchmark.
Further investigations
High school: Compare a small finite difference with the exact slope.
College: Prove the convergence range for this quadratic and implement gradient checks.
Working professionals: Explain a tuning decision with learning rate, failure criteria and a baseline.
Try a fresh case
For error (x−3)², start at x=7 and use step size 0.25. What is x after one update?
This is a public practice check. Retries support learning; matching a number does not certify independent proficiency.
Take the investigation further
Choose any extension. These are project prompts for you to carry out; they are not automatically assessed.
School investigation
Compare a small finite difference with the exact slope.
College investigation
Prove the convergence range for this quadratic and implement gradient checks.
Workplace investigation
Explain a tuning decision with learning rate, failure criteria and a baseline.
Keep the evidence, choose your next step
Completion records your own decision that you have worked through this investigation. Practice checks and independent project evidence are separate.