Source: https://goodhandover.co.uk/tools/gradient-descent-calculator/

[Computer science maths](https://goodhandover.co.uk/tools/computer-science-maths/#year-3) / Year 3

🔒 Files never leave your device

# Gradient descent calculator

Trace steps downhill on a quadratic loss and compare them with its analytic minimum. Your inputs stay on your device.

## Set up your task

Ready. Processing stays in this browser.

Files and text stay on your device. [Privacy details](https://goodhandover.co.uk/privacy/).

 

## How to use Gradient descent calculator

Trace steps downhill on a quadratic loss and compare them with its analytic minimum. The pre-filled problem gives you a worked starting point. Compare the response with your own working before trying the self-check below.

 

- Check the example inputs: Quadratic coefficient a, Linear coefficient b, Constant c, Initial x, Learning rate, Iterations.

- Change the inputs for your problem. Results update as you type, so finish entering the values before copying an answer.

- Use the working to check an intermediate value or assumption. Then change the example as suggested in the self-check and compare the result.

 

## Supported inputs and limits

Use f(x) = ax² + bx + c, with a positive, a learning rate from 0 to 2 and up to 50 iterations. Large rates can diverge.

 

## How it works

Gradient descent changes a parameter in the direction opposite the derivative. A learning rate sets the step size. For a quadratic with positive curvature there is a single minimum, so the result can be compared with an exact target found by setting the derivative to zero.

For this quadratic, subtracting the analytic minimiser from the update shows that each step multiplies the error by one minus twice the product of the rate and the quadratic coefficient. A multiplier with magnitude less than one contracts the error. A negative multiplier flips sides, and a magnitude above one expands it.

 

## Example

Run the pre-filled example. Its first result is “Final x: 3 · f(x): 1”.

Quadratic coefficient a

1

Linear coefficient b

-4

Constant c

4

Initial x

10

Learning rate

0.25

Iterations

3

Final x: 3 · f(x): 1
Analytic minimum at x = 2
Error multiplier per step: 0.5
1. Gradient 16 → x = 6
2. Gradient 8 → x = 4
3. Gradient 4 → x = 3

 

## Questions about Gradient descent calculator

### What does a learning rate of zero do?

The update subtracts zero times the gradient. The parameter stays at its starting point even if the displayed derivative is nonzero.

### Why can more steps make the result worse?

A large learning rate can steer past the minimum by more than the original error. Repeating the same update grows that error.

### Raise the example learning rate to 1.

The error multiplier becomes −1. The values oscillate around the minimum with the same distance on either side.

 
 

## Related tools

[Year 3: Advanced and applied maths](https://goodhandover.co.uk/tools/computer-science-maths/#year-3)

- [Softmax and cross-entropy calculator](https://goodhandover.co.uk/tools/softmax-calculator/)

- [2 × 2 eigenvalue calculator](https://goodhandover.co.uk/tools/eigenvalue-calculator/)

- [Bernoulli naive Bayes calculator](https://goodhandover.co.uk/tools/naive-bayes-calculator/)

- [Newton–Raphson calculator](https://goodhandover.co.uk/tools/newton-raphson-calculator/)

 

Last updated 24 November 2026
