Descend without leaving the allowed region
Can a constrained minimum have a nonzero derivative?
Entering midway? A derivative gives local change. Gradient descent subtracts a step size times the derivative.
Start with a concrete question
Minimize a quadratic over an interval; compare unconstrained proposals with feasible projected iterates.
Try the initial inputs, then write a prediction before changing one setting. All calculations run locally on your CPU.
Go directly to the experiment · Review prerequisite mathematics and return here
What do you expect?
Predict before calculating: Can a constrained minimum have a nonzero derivative?
Change one thing. Inspect what happens.
- Trace the first derivative and proposal by hand.
- Inspect how clipping changes a proposal beyond the bound.
- Compare step sizes 0, 0.25 and 1.
- Explain why x=2 is optimal when the bound is 2 even though f′(2)=−2.
Your settingsMechanism
Calculation belowEvidence
Compare outcomes
Objective and feasible gradient iterates
Horizontal: x. Vertical: f(x).
- 1. objective (solid line)
- 2. iterates (points)
- 3. constraint boundary (dashed line)
Axes use the displayed ranges.
Read plotted values as a table
| Series | x | f(x) |
|---|---|---|
| objective | 0 | 9 |
| objective | 0.1 | 8.41 |
| objective | 0.2 | 7.84 |
| objective | 0.3 | 7.29 |
| objective | 0.4 | 6.76 |
| objective | 0.5 | 6.25 |
| objective | 0.6 | 5.76 |
| objective | 0.7 | 5.29 |
| objective | 0.8 | 4.84 |
| objective | 0.9 | 4.41 |
| objective | 1 | 4 |
| objective | 1.1 | 3.61 |
| objective | 1.2 | 3.24 |
| objective | 1.3 | 2.89 |
| objective | 1.4 | 2.56 |
| objective | 1.5 | 2.25 |
| objective | 1.6 | 1.96 |
| objective | 1.7 | 1.69 |
| objective | 1.8 | 1.44 |
| objective | 1.9 | 1.21 |
| objective | 2 | 1 |
| objective | 2.1 | 0.81 |
| objective | 2.2 | 0.64 |
| objective | 2.3 | 0.49 |
| objective | 2.4 | 0.36 |
| objective | 2.5 | 0.25 |
| objective | 2.6 | 0.16 |
| objective | 2.7 | 0.09 |
| objective | 2.8 | 0.04 |
| objective | 2.9 | 0.01 |
| objective | 3 | 0 |
| objective | 3.1 | 0.01 |
| objective | 3.2 | 0.04 |
| objective | 3.3 | 0.09 |
| objective | 3.4 | 0.16 |
| objective | 3.5 | 0.25 |
| objective | 3.6 | 0.36 |
| objective | 3.7 | 0.49 |
| objective | 3.8 | 0.64 |
| objective | 3.9 | 0.81 |
| objective | 4 | 1 |
| objective | 4.1 | 1.21 |
| objective | 4.2 | 1.44 |
| objective | 4.3 | 1.69 |
| objective | 4.4 | 1.96 |
| objective | 4.5 | 2.25 |
| objective | 4.6 | 2.56 |
| objective | 4.7 | 2.89 |
| objective | 4.8 | 3.24 |
| objective | 4.9 | 3.61 |
| objective | 5 | 4 |
| iterates | 0 | 9 |
| iterates | 1.5 | 2.25 |
| iterates | 2 | 1 |
| iterates | 2 | 1 |
| iterates | 2 | 1 |
| constraint boundary | 2 | 0 |
| constraint boundary | 2 | 9 |
Follow the calculation
- Minimize f(x)=(x−3)² subject to 0≤x≤2. Requested start 0; feasible start=0.
- Step 1: x=0; derivative=-6; proposal=1.5; clipped to 1.5.
- Step 2: x=1.5; derivative=-3; proposal=2.25; clipped to 2.
- Step 3: x=2; derivative=-2; proposal=2.5; clipped to 2.
- Step 4: x=2; derivative=-2; proposal=2.5; clipped to 2.
A gradient points toward increasing objective; subtract it to descend. Projection restores feasibility. A boundary optimum may have a nonzero derivative because improving directions are forbidden.
Captures keep your inputs, prediction and observation. Results are recalculated from those inputs. Resetting inputs keeps your captures and challenge history.
Explain the mechanism
Descend without leaving the allowed region
Minimize a quadratic over an interval; compare unconstrained proposals with feasible projected iterates.
Concepts to recall
A derivative gives local change. Gradient descent subtracts a step size times the derivative.
Understand the mechanism
For f(x)=(x−3)², derivative 2(x−3) points toward increasing f.
At x=0 and step 0.25, the proposal is 1.5. The next proposal is 2.25 and clips to 2 if the upper bound is 2.
The unconstrained optimum is 3. If the interval ends earlier, its right endpoint is best. A large step can oscillate; convergence is not assumed from one improving step.
Symbols and calculation
proposal=x−η·2(x−3); next=min(U,max(0,proposal)). η is step size; U is upper bound.
Worked example
Minimize f(x)=(x−3)² subject to 0≤x≤2. Requested start 0; feasible start=0.
Step 1: x=0; derivative=-6; proposal=1.5; clipped to 1.5.
Step 2: x=1.5; derivative=-3; proposal=2.25; clipped to 2.
Step 3: x=2; derivative=-2; proposal=2.5; clipped to 2.
Step 4: x=2; derivative=-2; proposal=2.5; clipped to 2.
Your investigation
Trace the first derivative and proposal by hand.
Inspect how clipping changes a proposal beyond the bound.
Compare step sizes 0, 0.25 and 1.
Explain why x=2 is optimal when the bound is 2 even though f′(2)=−2.
Limits and interpretation
- These are bounded teaching models with explicit assumptions, not evidence of a real-world intervention.
Try a fresh case
At x=1 with f(x)=(x−4)² and step size 0.25, what is the unconstrained next x?
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
Explain a fresh small numerical case with a diagram or table and an argument.
College investigation
Implement the method, test a boundary or counterexample, and justify its assumptions.
Workplace investigation
Use a small decision scenario, state units and constraints, and test how the recommendation changes.
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.