Why this one matters. Loss told you how wrong a line is. It never told you which way to move. That gap is what gradient descent fills. Standing at your current a and b, it asks a narrow question — would nudging this number up or down make the loss smaller? — and then takes one step in the answer's direction. Repeat, and the line walks itself into place. Nobody solves anything; it just keeps stepping downhill. Every model you will ever train learns this way.

Arrived from Loss and Metric? The L (loss) box below is the Mean Square Error you just met — the same squared misses, averaged. The two boxes marked ∂L/∂a and ∂L/∂b are the new part: each says which way its parameter should move, and how urgently. Multiply by alpha, subtract, and that is one step.

The table starts empty on purpose. Press Initialize to set a starting line, then Next to take one step at a time and watch the loss fall.

Stuck on a symbol? Any label followed by a small mark explains itself — try this one and the explanation opens underneath it. That covers all six table headings, both data boxes, a, b and alpha, and every derivative below the table.

Want the formulas? Open 📝 Notes at the top of this page. It goes further into the concept and gives the formula behind every value you will see here — the loss, each derivative, and the update rule that moves a and b on each step.

Data and starting values

Everything here is yours to choose. Everything below the buttons is calculated from it.

ŷ = a x + b
x
y
a: b: alpha:
Calculated on every step
Line now — a: b:
\(x\)\(y\)\(ŷ\)\(ŷ-y\)\(2(ŷ-y)\)\((ŷ-y)^2\)
Epoch: L (loss):
\(\partial L \over \partial ŷ\): \(\partial ŷ \over \partial a\): \(\partial ŷ \over \partial b\):
\(\partial L \over \partial a\): \(\partial L \over \partial b\):
After this step — a: b:
chart: