In this video, we're going to work through a nasty looking function that will

require us to use all four of the time-saving rules that we've learned so far.

To make matters worse, this function isn't going to describe anything familiar.

So, we'll just be flying blind and have to trust the maths.

This will hopefully give you the confidence to

dive into questions in the following exercise.

Consider the rather nasty function f of x equals sin of

2x to the power of five plus 3x all over e to the 7x.

The essence of the sum product in the chain rules are all about

breaking your function down into manageable pieces.

So, the first thing to spot is that although it is currently expressed as a fraction,

we can rewrite f of x as a product by moving

the denominator up and raising it to the power of minus one.

There is actually another rule specifically

for dealing with fractions directly called the quotient rule,

but it requires memorizing an extra expression.

So we're not going to cover it in this course as you can always use

the approach that we've used here and rewrite your friction as a product.

Next, we'll split f of x up into the two parts of

the product and work out how to differentiate each parts separately,

ready to apply the product rule later on.

Let's start with the first part,

which we can call g of x.

We've got the trigonometric functions sin applied to a polynomial 2x to the 5 plus 3x.

This is a classic target for the chain rule.

So, all we need to do is take our function and

split up into the two parts in order to apply the chain rule.

So, we can take g of u equal sin of u,

and u of x equals 2x to the power five plus 3x.

Now, we've got these two separate functions,

and we're going to want to differentiate each of them in order to apply the chain rule.

So we say, okay,

g dash of u is going to just equal sin differentiates to cos.

So, cos u, and u dash of x is

going to equal 10x to the power of four plus three.

Now we've got these two expressions,

and I'm going to use a mix of notation for convenience.

And I'm going to say, okay, well,

dg by du multiplied

by du by dx is going to give us,

so we've got cos of u multiply by 10x to the power of four plus three.

And now we're going to want to have a final expression that doesn't include u.

So we can think about these two cancel each other out,

and we get dg by dx.

And this just equals k cos of u,

which is just 2x to the power of

5 plus 3x multiplied by 10x to the power of four plus three.

And that's it. We now have an expression for

the derivative g of x and already we've made use of the chain rule,

the sum rule, and the power rule.

Now, for the second half of our original expression,

which we will call h of x,

once again, we can simply apply the chain rule after splitting our function up.

So we can say that h of v equals e to the v,

and v of x equals minus 7x.

Now, once again, we've got our two functions.

We just want to find the derivatives.

So, h prime of v is just going to equal, well we've seen this one before, e to the v again.

And v prime of x is going to just be minus seven.

So, combining these two back together and using different notation,

we can say that dh by dv multiplied by dv by dx is just going to give us,

we've got minus seven times e to the minus 7x.

And actually, already all of our v's have disappeared.

So, this is already our final expression.

As we now have expressions for the derivatives of both parts of our product,

we can just apply the product rule to generate the final answer, and that's it.

We could rearrange and factorize this in

various fancy ways or even express it in terms of the original function.

However, there is a saying amongst coders that I think can be applied quite generally,

which is that premature optimisation is the root of all evil, which in this case means,

don't spend time tidying things up and rearranging

them until that you're sure that you've finished making a mess.

I hope that you've managed to follow along with this example,

and will now have the confidence to apply our four rules to other problems yourself.

In calculus, it's often the case that some initially scary looking functions,

like the ones we worked with just now,

turn out to be easy to tame if you have the right tools.

Meanwhile, other seemingly simple functions occasionally turn out to be beasts,

but this can also be fun.

So, happy hunting.