Products, Quotients, and Chains: Simple Rules for Calculus

Sharing is caring

In this post, we are going to explain the product rule, the chain rule, and the quotient rule. We derive each rule and demonstrate it with an example.

The product rule allows us to differentiate a function that includes the multiplication of two or more variables. The quotient rule enables us to differentiate functions with divisions. With the chain rule, we can differentiate nested expressions.

Product Rule

Assume we have the following equation involving a simple multiplication.

y = u \times v

As discussed in the post on rise over run, the derivative of some non-linear function is the slope of an infinitesimally small section at a particular point.

To obtain that section and the corresponding slope, we grow the components u and v by infinitesimally small amounts du and dv. This results in

y + dy = (u + du) \times (v + dv)

If we multiply this expression out, we arrive at the following.

y + dy = u \times v + u\times du + v\times dv + du\times dv

The term dudv is so small that it can be ignored. The term uv is equivalent to y, so we can subtract it from both sides of the equation. Now we are left with this expression.

dy = u\times dv + v \times du

If we divide this expression by dx, we arrive at our characteristic rise over run expression on the left.

 \color{red}\pmb{ \frac{dy}{dx} =u \frac{dv}{dx} + v\frac{ du}{dx} }

Congratulations, we just derived the product rule. To obtain the derivative of a function that multiplies two factors, multiply the first factor by the derivative of the second factor and add the second factor multiplied by the derivative of the first factor. Of course, this can be generalized to functions including more than one multiplication.

Example: Product Rule

Let’s do a little example to see how it works in practice

product rule example

The rest is just simple arithmetic, that you can do for yourself if you want.

Chain Rule

The chain rule tells us how to obtain the derivative of a nested function y with respect to x like the following one.

y = y(u)\\
u = u(x)

You obtain the derivative by

  • first differentiating y with respect to u
  • differentiating u with respect to x
  • multiplying the two resulting expressions.
\color{red}\pmb{ \frac{dy}{dx} = \frac{dy}{du} \frac{du}{dx} }

If you want to see a proof of why this works, I’d recommend checking out the following video by turksvids.

Example: Chain Rule

Let’s show how the chain rule works with an example. We start with a function y(x). To simplify, we can substitute the inner term with a third variable u

chain rule example part 1

Ok, let’s differentiate u and y individually and add them together.

chain rule example part 2

Substituting this into our formula, we get

chain rule example part 3

To check whether this is true, we can solve the same problem without the chain rule by multiplying it out before we differentiate. This isn’t equivalent to rigorous proof, but it is sufficient for most practical calculus applications.

chain rule example part 4

They give us the same answer.

Quotient Rule

With the chain rule and the product rule under our belt, we are now well equipped to tackle the quotient rule.

Let’s say we want to differentiate the following function.

y = \frac{u}{v}

This is equivalent to

y = (u)(v)^{-1}

From now on I will denote derivatives of a variable v as v’.

The term v^{-1} is a nested term with v being the inner term and (){-1} the “shell”. To get its derivative, we have to apply the chain rule.

(v^{-1})' =  -1v^{-2}v'

Now we can apply the product rule to get the derivative of y denoted by y’.

y' = u(v^{-1})' + u'v =-1v^{-2}v'u + u'v^{-1}

Let’s tidy up a bit and put the terms with negative powers back into the denominator.

y' = -\frac{v'u}{v^{2}} + \frac{u'}{v^{1}} 

Finally, we can multiply the right term by v to get the same denominator and simplify as follows.

\color{red}y' = -\frac{v'u}{v^{2}} + \frac{u'v}{v^{2}}  = \frac{u'v-v'u }{v^{2}}

Example: Quotient Rule

Now that we’ve derived the quotient rule successfully, we only need to take the terms of our function y(x) and substitute into the derived formula.

chain rule example part 4

This post is part of a series on Calculus for Machine Learning. To read the other posts, go to the index.


Sharing is caring

Leave a Reply

Your email address will not be published. Required fields are marked *