Learn

Learning preferences

Make learning more comfortable. Changes apply immediately.

Enlarges page content, including diagrams and their labels. You can also use your browser’s zoom.

Choose the colours that are easiest for you to distinguish. Applies to lesson diagrams and lab plots. Labels, shapes, hatching and line patterns also distinguish meanings. Source photographs and raw image brightness stay unchanged; mask-only views are available for image overlays.

ExampleComparisonSample link

Saved in this browser on this device. Preferences are separate from progress backups.

Learn through experiments

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.

1 · Try

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

2 · Predict

What do you expect?

Predict before calculating: Can a constrained minimum have a nonzero derivative?

3 · Experiment

Change one thing. Inspect what happens.

  1. Trace the first derivative and proposal by hand.
  2. Inspect how clipping changes a proposal beyond the bound.
  3. Compare step sizes 0, 0.25 and 1.
  4. Explain why x=2 is optimal when the bound is 2 even though f′(2)=−2.
Experiment inputs
Inputs
Your settings
Mechanism
Calculation below
Evidence
Compare outcomes
Final x2 input units
Final objective1 squared units
Exact constrained optimum2 input units
Gap to best objective0 squared units

Objective and feasible gradient iterates

Horizontal: x. Vertical: f(x).

002.54.559iterates: (0, 9)iterates: (1.5, 2.25)iterates: (2, 1)iterates: (2, 1)iterates: (2, 1)constraint boundary: (2, 0)constraint boundary: (2, 9)
  • 1. objective (solid line)
  • 2. iterates (points)
  • 3. constraint boundary (dashed line)

Axes use the displayed ranges.

Read plotted values as a table
Seriesxf(x)
objective09
objective0.18.41
objective0.27.84
objective0.37.29
objective0.46.76
objective0.56.25
objective0.65.76
objective0.75.29
objective0.84.84
objective0.94.41
objective14
objective1.13.61
objective1.23.24
objective1.32.89
objective1.42.56
objective1.52.25
objective1.61.96
objective1.71.69
objective1.81.44
objective1.91.21
objective21
objective2.10.81
objective2.20.64
objective2.30.49
objective2.40.36
objective2.50.25
objective2.60.16
objective2.70.09
objective2.80.04
objective2.90.01
objective30
objective3.10.01
objective3.20.04
objective3.30.09
objective3.40.16
objective3.50.25
objective3.60.36
objective3.70.49
objective3.80.64
objective3.90.81
objective41
objective4.11.21
objective4.21.44
objective4.31.69
objective4.41.96
objective4.52.25
objective4.62.56
objective4.72.89
objective4.83.24
objective4.93.61
objective54
iterates09
iterates1.52.25
iterates21
iterates21
iterates21
constraint boundary20
constraint boundary29

Follow the calculation

  1. Minimize f(x)=(x−3)² subject to 0≤x≤2. Requested start 0; feasible start=0.
  2. Step 1: x=0; derivative=-6; proposal=1.5; clipped to 1.5.
  3. Step 2: x=1.5; derivative=-3; proposal=2.25; clipped to 2.
  4. Step 3: x=2; derivative=-2; proposal=2.5; clipped to 2.
  5. 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.

4 · Understand

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

  1. Trace the first derivative and proposal by hand.

  2. Inspect how clipping changes a proposal beyond the bound.

  3. Compare step sizes 0, 0.25 and 1.

  4. 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.
5 · Apply

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.

6 · Continue

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.