# Rules for differentiation for any number of functions

Here are some rules which should let you differentiate all sorts of function equations. They can be good for smaller equations but if you get a more involved equation, you may wish to use logarithmic differentiation which breaks it up in to simpler parts.

Notation
First of all for a function a(x), its differential is a'(x) so for example:
if a(x) = sin x then
a'(x) = cos x
I also use • for multiplying in order to avoid any confusion between × and x.

## The product rule for multiplying

There is a pattern for this as you can see for any number of equations. You repeat the terms and make one of them a differential:
y(x) = a(x)•b(x)
y'(x) = a'(x)•b(x) + a(x)•b'(x)

y(x) = a(x)•b(x)•c(x)
y'(x) = a'(x)•b(x)•c(x) + a(x)•b'(x)•c(x) + a(x)•b(x)•c'(x)

y(x) = a(x)•b(x)•c(x)•d(x)
y'(x) = a'(x)•b(x)•c(x)•d(x) + a(x)•b'(x)•c(x)•d(x) + a(x)•b(x)•c'(x)•d(x) + a(x)•b(x)•c(x)•d'(x)

etc...
Example:
if y(x) = x2 • sin x
 a(x) = x2 a'(x) = 2x b(x) = sin x b'(x) = cos x
y'(x) = a'(x) • b(x) + a(x) • b'(x)
= 2x • sin x + x2 • cos x

## The quotient rule for dividing

 y(x) = a(x) b(x)

 y'(x) = a'(x)•b(x) - a(x)•b'(x) b2(x)

## Function of a function

As you can see again, there is a pattern when you increase the number of functions
y(x) = a(x)
y'(x) = a'(x)

y(x) = b(a(x))
y'(x) = a'(x) • b'(a(x))

y(x) = c(b(a(x)))
y'(x) = a'(x) • b'(a(x)) • c'(b(a(x)))

etc.

Example

if y = Sin(e2x) then this is an equation with three functions which I re-arrange so I can think about it more easily:
y = Sin (exp(2x))
 a(x) = 2x a'(x) = 2 b(x) = ea(x) b'(x) = ea(x) = e2x c(x) = Sin b(x) c'(x) = Cos b(x) = Cos e2x

Now I combine them:
y'(x) = a'(x) • b'(a(x)) • c'(b(a(x))) =
2 × e2x × Cos e2x =
2e2x • Cos e2x

Arcsines etc:

 δSin-1x = 1 δx √(1-x2)

 δCos-1x = -1 δx √(1-x2)

 δTan-1x = 1 δx 1+x2

## An example using multiple rules

You may have come across an equation for calculating the surface area of a sphere which is 4πr2 but I asked myself "where did that equation come from?" so I calculated it from first principles.
I need two things, the equation for half a circle:
y = r √(1 - x2/r2) where r is the radius
and an equation for calculating the surface area of anything:
 Surface area = ∫ b 2πy√ (1 + ( dy ) 2 ) dx a dx
If you want to read where this equation came from, you can find it here.
The upper and lower boundary will be -r and r.
Now I'm going to break this equation down. I have to differentiate dy / dx. In order to do this, I have to use the product rule and the function of a function:
y(x) = r √(1 - x2/r2) = √(r2 - x2) BUT I will not use the simpler one so I can show you the multiple rules which still gives you the correct answer
y'(x) = a'(x) • b'(a(x)) ← this is what I want to find out so:

 a(x) = r a'(x) = 0 (because r is a constant) b(x) = √(1 - x2/r2) b'(x) = ?

to find b'(x), I have to find the differential of √(1 - x2/r2) which I can calculate with the function of a function rule:
if f(x) = h(g(x)) then f'(x) = g'(x) • h'(g(x))
 g(x) = 1 - x2 g'(x) = -2 x r2 r2
 h(x) = √g(x) h'(x) = 1 2√(g(x))

f'(x) = g'(x) • h'(g(x))
 = -2 x • 1 = -x r2 2√(1 - x2/r2) r2√(1- x2/r2)

Now I can go back to that product rule and put in:
 b'(x) = -x r2√(1- x2/r2)

I have everything to calculate dy / dx. I will complete the product rule:
y'(x) = a'(x) • b'(a(x))

 = - x r√(1- x2/r2)

The next bit I want to do is:
 ( dy ) 2 dx
which is:
 x2 = x2 r2(1- x2/r2) r2 - x2 as long as |x| ≠ r

In order to calculate:
 1 + ( dy ) 2 dx
I will add (r2 - x2) / (r2 - x2) which is the same as adding 1 so I can make the denominator r2 - x2:
 1 + x2 = (r2- x2) + x2 = r2 r2- x2 r2 - x2 r2 - x2 as long as r2 ≠ x2

So, what do we have so far?
 Surface area = 2πr ∫ r √(1 - x2/r2)√ ( r2 ) dx -r r2 - x2

Since √2 × √3 = √(2×3), then I will apply the same rule as above, missing out some steps (after all, I doubt anyone has been reading this so far)
 Surface area = 2πr ∫ r √(( 1- x2 )( r2 )) dx -r r2 r2 - x2
If you multiply out the bit in the square root, you get:
 r2 - x2 r2 - x2 which equals 1 if r2 ≠ x2 and √1 = 1

So now we have:
 Surface area = 2πr ∫ r 1 dx = 2πr [ x ] r -r -r
= 2πr(r - - r) = 4πr2

## Logarithmic differentiation

This can be a very useful technique because it breaks up a complicated equation in to simpler parts. It works by taking the logarithm of the equation, then it can be split up using the rules of logarithms such as ln(ab) = ln(a) + ln(b).
This technique uses this rule:
 [ln(f(x))]' = f'(x) f(x)

So the differential is the differential of the function over the function itself. Here's what we do:
• Take the logarithm of both sides and split up (simplify)
• Differentiate everything according to the rule [ln(fx)]' = ... putting differential over each function
• Transpose for f'(x) which is another way of saying dy / dx
My first example is a really simple one for f(x) = x2 just to demonstrate the technique.
I'm going to modify it a little and use f(x) = xx. I take the logarithm of both sides ln(y) = ln(xx) and split it up in to ln(y) = ln(x) + ln(x) then I differentiate this giving us:
 [ln(f(x))]' = 1 x + 1 x
(the differential of x is 1 - the differential over itself)

I change the [ln(f(x))]' part:
 f'(x) f(x) = 1 x + 1 x

I transpose this by multiplying both sides by f(x) but f(x) = x2 so I can replace f(x) with x2 and simplify it:
f'(x)=2x

Now I will show you something more complicated. This shows the usefulness of this technique.
 f(x) = x2 sin x cos 2x now I take the logarithm of this and split it up
ln(f(x)) = ln(x2) + ln(sin x) - ln(cos 2x) which I differentiate by placing the derivative of each function over itself:
 f'(x) f(x) = 2x x2 + cos x sin x - -2 sin 2x cos 2x which simplifies to:
 f'(x) f(x) = 2 x + cos x sin x + 2 tan 2x so the next step is to multiply each side by f(x):
 f'(x) = ( x2 sin x cos 2x )( 2 x + cot x + 2 tan 2x )

You can try it with f(x) = sin2 x , split it up with ln(y) = ln (sin x) + ln(sin x) and get
f'(x) = 2 sin (x) cos (x) = sin (2x)
This equals sin 2x because I used a double angle formula. You could also graph 2 sin (x) cos (x) and experiment to see if you can find an equivalent sine wave.