The Chain Rule, Layer by Layer
Compose derivatives through the network.
The Chain Rule, Layer by Layer is a free Deep Learning Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Deep Learning Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
A Net Is Nested Functions
A neural network is just functions wrapped inside functions: each layer feeds its output into the next. Backprop needs the derivative of that whole stack.
The Chain Rule in One Line
The chain rule says the derivative of nested functions multiplies the derivatives of each piece. That single fact is the engine behind all of backprop. ⛓️
dy/dx = dy/du * du/dxA Tiny Composition
Say z depends on y, and y depends on x. To get how z changes with x, you multiply dz/dy by dy/dx. Each link passes its slope along.
Layers Are Links in a Chain
Every layer is one link. The loss sits at the far end, the input at the near end, and gradients flow back link by link as a chain of multiplications.
Start From the Loss
Backprop begins at the loss and asks: how does loss change if this layer output nudges a bit? That answer is the first derivative in the chain.
Pass the Gradient Backward
Each layer receives the gradient from the layer above, multiplies by its own local derivative, and hands the result to the layer below.
grad_below = grad_above * local_derivativeLocal Derivative of a Layer
A layer only needs to know its own local derivative: how its output changes with its input and weights. It never needs the whole network at once.
Weights Get Their Own Gradient
At each layer the incoming gradient also tells you how the loss changes with that layer's weights. That is exactly what the optimizer will use to update them.
Why Order Matters
You multiply derivatives in reverse order, from loss back to input. Going forward computes values; going backward computes how to improve them.
It Scales to Any Depth
Add ten more layers and nothing changes: you just multiply ten more local derivatives into the chain. Depth is no problem for the chain rule.
The Whole Idea, Compressed
Backprop is the chain rule applied layer by layer, from the loss back to the inputs, multiplying local slopes to find each weight's gradient.
Quick Check
Let's check the core rule.
Recap
A network is nested functions, so its derivative is a chain of multiplied local slopes. Backprop walks that chain from loss back to input. ⛓️
Frequently asked questions
Is the “The Chain Rule, Layer by Layer” lesson free?
Yes — the full text of “The Chain Rule, Layer by Layer” is free to read here on the web, and the Deep Learning Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Deep Learning Academy course, upgrade to CoddyKit PRO.
What will I learn in “The Chain Rule, Layer by Layer”?
Compose derivatives through the network. You practise Deep Learning Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Deep Learning Academy?
No prior experience is required. Deep Learning Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “The Chain Rule, Layer by Layer” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Deep Learning Academy lesson?
Yes. Every Deep Learning Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- The Chain Rule, Layer by Layer
- Forward Caches, Backward Reuses
- Backprop a Tiny Net by Hand
- Vanishing & Exploding Gradients