Monday, May 6, 2013

Differentiating Trig Functions

I'm going to skip ahead in the book a bit and go straight to the differentiation and integration bits, because I don't really have to draw diagrams to explain them (and drawing diagrams on Paint is annoying).

Differentiating Trig Functions- First Principles

First principles- the random long-winded way of differentiation which you only do when you're trying to learn the ideas and concepts behind it, but then drop when you learn quicker, easier methods.

I'm not sure whether or not I've explained first principles before on my blog, so I'll try and briefly explain the concepts behind it here. Differentiation is all about finding the gradient, and gradient can be calculated by rise over run (i.e. difference in y-values divided by difference in x-values). Therefore, one way of finding the gradient at any given point along a curve is to find the gradient between that point and another point very very close to it. You can keep adjusting the distances between the two points until there's only a very infinitesimally small difference between the points, and then you'll get the gradient.

Let's say that you're looking for the gradient at the point where x = x on the curve y = f(x). When x = x, the y-coordinate of the curve is given by f(x), so our first point is (x, f(x)). Our next point is h more units along the x-axis, so its x-coordinate is x+h, and its y-coordinate is f(x+h), giving us the point (x + h, f(x+h)). Now, gradient is rise over run, so the gradient formula is (f(x+h)-f(x))/((x+h)-x), which simplifies down to (f(x+h)-f(x))/h. Now, to get the gradient at point x, you want the distance between the two points (h) to equal zero. But wait! If h = 0, then you're dividing by 0, and you can't do that!

That's why we use a limiting equation, as represented by that "lim h->0" thingy.

(I love Word's "insert equation" feature...)

Now, let's put this into action. Chances are, you know that the derivative of y = x^2 is simply 2x. How do we go about proving this with first principles?

Well, on the top line we first substitute f(x + h) for (x + h)^2 (since the function, f(x), is x^2) and f(x) for x^2. Then we expand and simplify this so we have (2hx + h^2)/h, h approaching zero. Now we factor out h to get (h(2x + h))/h and then cancel out the hs so we get 2x + h. Now we don't have to bother about h approaching zero. Instead, we can allow h to equal zero, since we're no longer dividing by h and therefore making h zero won't make the universe explode. That leaves us with 2x as the derivative of x^2.

We can use a similar approach to find out the derivatives of sin x and cos x, but there's a couple of things that you have to know first.

As x approaches zero, (sin x)/x = 1 and (1-cos x)/x = 0. These can be determined by using tables of values (i.e. working out the values of these two functions by calculating for x = 0.01, x =0.001 etc.) or by looking at the graphs of the functions.

Here's how the derivative of sin x can be calculated using first principles:


As for the derivative of cos x... I'll leave that one for you to do as practise! (Actually I'm only saying that because I can't be stuffed typing that one up.)

The derivative of sin x is cos x, and the derivative of cos x is -sin x. REMEMBER THAT. It's helpful knowledge to have on hand.

tan x has a retarded derivative, or rather derivatives (yes, it has more than one acceptable derivative. One way to differentiate tan x is by using the quotient rule, since tan x = (sin x) / (cos x).

When y = (sin x) / (cos x), dy/dx = (cos x cos x - sin x (-sin x)) / (cos x)^2
= ((cos x)^2 + (sin x) ^2) / (cos x)^2
But (cos x)^2 + (sin x)^2 = 1 (Pythagorean identity, which I realise I haven't mentioned yet on this blog)
So dy/dx = 1 / (cos x)^2.

So one possible derivative of tan x is 1 / (cos x)^2.

Now, apart from sine, cosine and tangent, there are three more trig functions (which you don't really need to know very well for now) which are the reciprocals of the first three functions. They are secant (sec), cosecant (cosec) and cotangent (cot). Secant is 1 / cos x, cosecant is 1 / sin x and cotangent is 1 / tan x.

Since sec = 1 / cos x, (sec x)^2 = 1 / (cos x)^2, which is the derivative of tan x. Therefore, another possible derivative of tan x is (sec x)^2.

Also, there's an alternative way of simplifying my second line of working for the derivative of tan x using the quotient rule. This alternative simplification leads to a third acceptable derivative of tan x.

((cos x)^2 + (sin x) ^2) / (cos x)^2 = ((cos x)^2) / (cos x)^2 + ((sin x)^2) / (cos x)^2))
= 1 + (tan x)^2

Now I'm going to summarise the derivatives for the three main functions, because it's handy having everything in one place.

Derivative of sin x = cos x
Derivative of cos x = -sin x
Derivative of tan x = (1 / (cos x)^2), (sec x)^2 or 1 - (tan x)^2, depending on your mood and the question that you're trying to solve

Rules of Differentiating Trig Functions

Differentiating trig functions is annoying (though nowhere near as annoying as integrating them) because you have to make sure not to get mixed up between the derivatives and stuff (my main problem is getting the positive/negative signs the right way around). At least they go by most of the same rules as pretty much every other function with regards to differentiation: you can still use the good ol' product, chain and quotient rules.

I'll just do a quick example with the chain rule because I believe that that's where it's easiest to get mixed up with regards to what order to do the steps in.

Let's use y = (cos 5x)^3 as an example.

Let cos 5x = u, and 5x = s. Therefore ds / dx = 5. u = cos 5x = cos s, so du/ds = - sin s. Finally y = u^3, so dy/du = 3u^2.

Now, due to the chain rule, dy/dx = (dy/du)(du/ds)(ds/dx).
Therefore, dy/dx = (3u^2)(-sin s)(5).
Substituting to get an answer in terms of x, dy/dx = 3((cos 5x)^2)(- sin 5x)(5) = (-15 sin 5x)(cos 5x)^2.

Wow, explaining that in full was more complicated than I was expecting since cos 5x warranted an extra chain as well (you need to multiply by the derivative of 5x). Just remember that the power takes precedence, then the stuff in the brackets. And take care in working out the derivative of the stuff in the brackets too.

That's all from me on differentiating trig functions for now, but if you want more clarification, feel free to ask!

No comments:

Post a Comment