Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 34

Mastering Derivative Rules: Product, Quotient, and Chain

Recommended resources

Introduction

In our previous lesson, we established the fundamental rules for finding derivatives of functions that are added or subtracted, like polynomials. You learned to use the Power, Exponential, and Logarithmic rules on a term-by-term basis. This was a crucial first step, but functions in the real world, especially in machine learning, are rarely so simple. They are often built by multiplying, dividing, or even nesting functions within each other.

This lesson equips you with the three most powerful tools in your differentiation toolkit. Our goal is to apply the product, quotient, and chain rules to compute derivatives. We'll move beyond simple sums and learn how to systematically break down complex functions. Mastering these rules is non-negotiable for understanding how AI models learn, as they form the mechanical basis for the optimization algorithms we'll study later. Following your preference, we will explore the theory behind each rule before applying it.


1. The Product Rule: Differentiating Multiplied Functions

Let's start with a question: if you have a function , is the derivative simply ? It's a tempting idea, but it's incorrect. Let's see why.

Calculus 1 Lecture 2.3: The Product and Quotient Rules for Derivatives of Functions

Professor Leonard provides an excellent explanation for why we need a special rule for products. This short segment will build the theoretical foundation for the Product Rule.

Watch from the beginning to 07:15. Pay close attention to the example with x^2 * x^3. Notice how taking the derivatives separately and multiplying them gives the wrong answer, which proves the need for a specific product rule.

As you saw, a more nuanced approach is required. The total change in the product depends on how each part contributes to the whole. A fantastic way to visualize this is to think of the function as the area of a rectangle with sides and .

The Product, Power & Chain Rules

This article from BetterExplained offers a powerful intuitive analogy for the Product Rule using a changing rectangle. This will help you understand why the formula is structured the way it is.

Read the section titled 'Multiplication (Product Rule)'. Focus on the diagram and the explanation of how the total change in area is the sum of the two 'slivers' contributed by each side changing independently.

The intuition is that the total change is the sum of two contributions:

  1. The change from (which is ) multiplied by the current size of .
  2. The change from (which is ) multiplied by the current size of .

This leads directly to the formal Product Rule.

Product Rule and Quotient Rule Summary
A concise summary of the Product Rule formula. The derivative of a product is the derivative of the first function times the second, plus the first function times the derivative of the second.

In Leibniz notation, if , then:

Let's see this in action.

Derivatives of Composite Functions - Chain Rule, Product & Quotient Rule

Now, let's watch The Organic Chemistry Tutor apply the Product Rule to a few examples. This will solidify the mechanical process.

Watch from the beginning to 04:15. Observe how he methodically identifies 'f' and 'g', finds their derivatives, and plugs them into the formula.


2. The Quotient Rule: Differentiating Divided Functions

Just as with products, we can't simply differentiate the numerator and denominator separately. We need a specific rule for quotients of the form .

The formula is similar in spirit to the product rule but with a crucial subtraction and a new term in the denominator.

Product Rule and Quotient Rule Summary
The Quotient Rule formula. Note the subtraction in the numerator and the squared term in the denominator.

If , the Quotient Rule is:

A common mnemonic to remember this is: "Low D-high minus High D-low, square the bottom and away we go!", where "Low" is , "High" is , and "D" means "the derivative of".

Let's watch this rule being applied.

Derivatives of Composite Functions - Chain Rule, Product & Quotient Rule

Let's return to The Organic Chemistry Tutor's video to see the Quotient Rule in practice.

Watch from 08:41 to 12:45. Pay attention to how the order of terms in the numerator is critical because of the subtraction.


3. The Chain Rule: Differentiating Composite Functions

The Product and Quotient rules handle functions that are multiplied or divided. But what about functions that are nested inside one another, like ? This is called a composite function. To differentiate these, we need the Chain Rule.

The core idea of the Chain Rule is to differentiate from the "outside in". You take the derivative of the outermost function, leaving the inner function untouched, and then you multiply by the derivative of the inner function.

Let's build our intuition for this first.

The Product, Power & Chain Rules

The BetterExplained article provides another brilliant analogy for the Chain Rule, describing it as a propagation of a 'wiggle' through a series of connected machines.

Read the sections 'The Chain Rule: It's Not So Bad' and 'Chain Rule: Gotchas'. Focus on the concept of 'zooming into' a function and how an initial change gets scaled at each step in the chain.

This "outside-in" process is formalized in the Chain Rule.

Chain Rule Formula
The Chain Rule for a composite function `y = f(g(x))`. The derivative `dy/dx` is the product of the derivative of the outer function `f` (with `g(x)` as its input) and the derivative of the inner function `g`.

If , then:

Let's see this put to work with some clear, step-by-step examples.

Calculus I - Chain Rule - Pauls Online Math Notes

Paul's Online Math Notes provides a very clear, methodical explanation of the Chain Rule, identifying the 'inside' and 'outside' functions.

Read the sections from the 'Chain Rule' heading through 'Example 2'. This will walk you through the formal definition and show you how to apply it to polynomials, trigonometric, exponential, and logarithmic functions.

The Chain Rule can be applied multiple times for deeply nested functions, like peeling an onion one layer at a time.

Derivatives of Composite Functions - Chain Rule, Product & Quotient Rule

Let's see some more complex applications, including functions with multiple 'layers'.

Watch from 34:21 to 39:11. Notice in the example y = tan^3(5x^2 + 8) how he works from the outermost power (the cube), to the tangent function, and finally to the polynomial inside.


4. Combining the Rules

True mastery comes from being able to combine these rules to tackle complex functions. You might encounter a product where one of the factors is a composite function, or a quotient where the numerator requires the chain rule. The key is to identify the main structure first (product, quotient, or chain) and then apply the other rules as needed.

Let's look at an example where the Product Rule and Chain Rule are used together.

Derivatives of Composite Functions - Chain Rule, Product & Quotient Rule

This final clip shows how to handle a function that is a product of two composite functions, requiring you to use the Product Rule as the main structure and the Chain Rule for the individual derivatives.

Watch from 39:11 to 43:30. Follow how he sets up the Product Rule first, and then, as he needs to find f' and g', he applies the Chain Rule to each part.

This systematic, hierarchical approach is exactly the kind of multi-step calculation you aspire to master. Identify the outermost operation, apply the corresponding rule, and then solve the smaller derivative problems that arise, one step at a time.


Conclusion

In this lesson, you've added the three most important differentiation rules to your arsenal. These rules allow you to move from simple functions to the complex, interconnected structures that define real-world models.

Key Takeaways:

  • The Product Rule: Used for functions of the form . The derivative is .
  • The Quotient Rule: Used for functions of the form . The derivative is .
  • The Chain Rule: Used for composite functions of the form . The derivative is , working from the "outside in".
  • Complex derivatives are solved by identifying the main structure first and applying rules hierarchically.

Preview of the Next Lesson:
So far, all our functions have had a single input, . However, the loss functions in machine learning depend on millions of parameters (weights and biases). To understand how to optimize these, we need to extend our calculus to functions of multiple variables. In the next lesson, you will learn to compute partial derivatives of multivariable functions. You will find that the rules you mastered today are the direct building blocks for this more advanced topic.