What is a gradient, and why do we multiply it during training?

  • 1 input (x)
  • 1 weight (w)
  • 1 output
  • 1 training example

After this, XOR will be easy.

STEP 1 Define the simplest possible neural network

We take:

One weight (w). One input (x). Output is the multiplication.

Let the training pair be:

We want:

But pretend we don’t know that.

We want training to find this (w).

STEP 2 Define loss function

Take the simplest loss:

This is the function we want to minimize.

Put ( y = w x):

The loss depends on one variable: the weight (w).

So learning is simply:

STEP 3 Gradient = derivative of L(w)

The gradient here is:

Now compute it:

Derivative:

Simplify:

STEP 4 Ask the ONLY important question:

What does this derivative tell us?

Answer (strict calculus meaning):

Example:

Pick an initial weight:

Compute derivative:

This value -20 is the entire key.

Let’s understand only this one number.

STEP 5 What does “-20” actually mean? (no intuition)

Plug back into calculus meaning:

So:

This says:

If w increases by 1, L decreases by roughly 20.

That is: Increase (w) → Loss goes down.

If instead we decreased (w), L would go up.

This comes directly from the sign.

So the derivative contains TWO numbers:

  1. Sign (increase/decrease)
  2. Magnitude (how strong)

That’s ALL we need to update the weight.

STEP 6 Why do we multiply the gradient?

The update rule is:

Let’s plug the numbers:

  • (\eta = 0.1)
  • (\frac{dL}{dw} = -20)

Update:

Now compute the new loss:

Old loss:

New loss:

Loss dropped from 50 to 18.

Why? Because the gradient told us exactly how L changes when w changes.

That’s all training is.

STEP 7 One more update

Use (w = 2).

Compute derivative:

Do update:

Loss now:

Loss keeps dropping.

STEP 8 Continue until w ≈ 5

Gradient descent will move:

Eventually:

which makes:

  • Loss (L(w)) is a function.
  • Training = minimizing this function.
  • The gradient is the exact rate of change of L with respect to w.
  • If gradient = -20, it means increase w → L decreases fast.
  • Update rule subtracts gradient to move L downward.
  • Step size controlled by (\eta).
  • Repeating updates finds the value that minimizes loss.

Everything else in neural networks is just the same process with more weights and chain rule.