This section and the *differentiation technique* section can be skipped if you are already familiar with calculus/differentiation.
In calculus, differentiation is a very important operation applied to functions of real numbers. To differentiate a function f(x), we simply evaluate the limit
lim
h
→
0
f
(
x
+
h
)
−
f
(
x
)
h
{\displaystyle \lim _{h\to 0}{\frac {f(x+h)-f(x)}{h}}}
where the
lim
h
→
0
{\displaystyle \lim _{h\to 0}}
means that we let h approach 0. However, for now, we can simply think of it as putting h to 0, i.e., letting h = 0 at an appropriate time. There are various notations for the result of differentiation (called the derivative), for example
f
′
(
x
)
=
lim
h
→
0
f
(
x
+
h
)
−
f
(
x
)
h
{\displaystyle f'(x)=\lim _{h\to 0}{\frac {f(x+h)-f(x)}{h}}}
and
d
y
d
x
=
lim
h
→
0
f
(
x
+
h
)
−
f
(
x
)
h
{\displaystyle {\frac {dy}{dx}}=\lim _{h\to 0}{\frac {f(x+h)-f(x)}{h}}}
mean the same thing. We say, f'(x) is the derivative of f(x). Differentiation is useful for many purposes, but we shall not discuss why calculus was invented, but rather how we can apply calculus to the study of generating functions.
It should be clear that if
g
(
x
)
=
f
(
x
)
{\displaystyle g(x)=f(x)}
then
g
′
(
x
)
=
f
′
(
x
)
{\displaystyle g^{\prime }(x)=f^{\prime }(x)}
the above law is important. If g(x) a closed-form of f(x), then it is valid to differentiate both sides to obtain a new generating function.
Also if
h
(
x
)
=
g
(
x
)
+
f
(
x
)
{\displaystyle h(x)=g(x)+f(x)}
then
h
′
(
x
)
=
g
′
(
x
)
+
f
′
(
x
)
{\displaystyle h^{\prime }(x)=g^{\prime }(x)+f^{\prime }(x)}
This can be verified by looking at the properties of limits.
Differentiate from first principle f(x) where
f
(
x
)
=
x
2
{\displaystyle f(x)=x^{2}}
Firstly, we form the difference quotient
f
′
(
x
)
=
lim
h
→
0
(
x
+
h
)
2
−
x
2
h
{\displaystyle f^{\prime }(x)=\lim _{h\to 0}{\frac {(x+h)^{2}-x^{2}}{h}}}
We can't set h to 0 to evaluate the limit at this point. Can you see why? We need to expand the quadratic first.
=
lim
h
→
0
x
2
+
2
x
h
+
h
2
−
x
2
h
{\displaystyle =\lim _{h\to 0}{\frac {x^{2}+2xh+h^{2}-x^{2}}{h}}}
=
lim
h
→
0
2
x
h
+
h
2
h
{\displaystyle =\lim _{h\to 0}{\frac {2xh+h^{2}}{h}}}
We can now factor out the h to obtain now
lim
h
→
0
2
x
+
h
{\displaystyle \lim _{h\to 0}2x+h}
from where we can let h go to zero safely to obtain the derivative, 2x . So
f
′
(
x
)
=
2
x
{\displaystyle f^{\prime }(x)=2x}
or equivalently:
(
x
2
)
′
=
2
x
{\displaystyle (x^{2})'=2x}
Differentiate from first principles, p(x) = xn .
We start from the difference quotient:
p
′
(
x
)
=
lim
h
→
0
(
x
+
h
)
n
−
x
n
h
{\displaystyle p'(x)=\lim _{h\to 0}{\frac {(x+h)^{n}-x^{n}}{h}}}
By the binomial theorem, we have:
=
lim
h
→
0
1
h
(
x
n
+
n
x
n
−
1
h
+
.
.
.
+
h
n
−
x
n
)
{\displaystyle =\lim _{h\to 0}{\frac {1}{h}}(x^{n}+nx^{n-1}h+...+h^{n}-x^{n})}
The first x n cancels with the last, to get
=
lim
h
→
0
1
h
(
n
x
n
−
1
h
+
.
.
.
+
h
n
)
{\displaystyle =\lim _{h\to 0}{\frac {1}{h}}(nx^{n-1}h+...+h^{n})}
Now, we bring the constant 1/h inside the brackets
=
lim
h
→
0
n
x
n
−
1
+
.
.
.
+
h
n
−
1
{\displaystyle =\lim _{h\to 0}nx^{n-1}+...+h^{n-1}}
and the result falls out:
=
n
x
n
−
1
{\displaystyle =nx^{n-1}}
Important Result
If
p
(
x
)
=
x
n
{\displaystyle p(x)=x^{n}}
then
p
′
(
x
)
=
n
x
n
−
1
{\displaystyle p'(x)=nx^{n-1}}
As you can see, differentiate from first principle involves working out the derivative of a function through algebraic manipulation, and for that reason this section is algebraically very difficult.
Assume that if
h
(
x
)
=
f
(
x
)
+
g
(
x
)
{\displaystyle h(x)=f(x)+g(x)}
then
h
′
(
x
)
=
f
′
(
x
)
+
g
′
(
x
)
{\displaystyle h^{\prime }(x)=f^{\prime }(x)+g'(x)}
Differentiate
x
2
+
x
5
{\displaystyle x^{2}+x^{5}}
Solution
Let
h
(
x
)
=
x
2
+
x
5
{\displaystyle h(x)=x^{2}+x^{5}}
h
′
(
x
)
=
2
x
+
5
x
4
{\displaystyle h'(x)=2x+5x^{4}}
Show that if
g
(
x
)
=
A
f
(
x
)
t
h
e
n
{\displaystyle g(x)=Af(x)then}
g
′
(
x
)
=
A
f
′
(
x
)
{\displaystyle g^{\prime }(x)=Af^{\prime }(x)}
Solution
g
(
x
)
=
A
f
(
x
)
g
′
(
x
)
=
lim
h
→
0
A
h
(
f
(
x
+
h
)
−
f
(
x
)
)
=
A
lim
h
→
0
1
h
(
f
(
x
+
h
)
−
f
(
x
)
)
=
A
f
′
(
x
)
{\displaystyle {\begin{matrix}g(x)&=&Af(x)\\\\g'(x)&=&\lim _{h\to 0}{\frac {A}{h}}(f(x+h)-f(x))\\\\&=&A\lim _{h\to 0}{\frac {1}{h}}(f(x+h)-f(x))\\\\&=&Af'(x)\end{matrix}}}
Differentiate from first principle
f
(
x
)
=
1
1
−
x
{\displaystyle {\begin{matrix}f(x)={\frac {1}{1-x}}\end{matrix}}}
Solution
f
′
(
x
)
=
lim
h
→
0
1
h
(
1
1
−
(
x
+
h
)
−
1
1
−
x
)
=
lim
h
→
0
1
h
(
1
−
x
−
(
1
−
(
x
+
h
)
)
(
1
−
(
x
+
h
)
)
(
1
−
x
)
)
=
lim
h
→
0
1
h
(
h
(
1
−
(
x
+
h
)
)
(
1
−
x
)
)
=
lim
h
→
0
1
(
1
−
(
x
+
h
)
)
(
1
−
x
)
=
1
(
1
−
x
)
2
{\displaystyle {\begin{matrix}f'(x)&=&\lim _{h\to 0}{\frac {1}{h}}({\frac {1}{1-(x+h)}}-{\frac {1}{1-x}})\\\\&=&\lim _{h\to 0}{\frac {1}{h}}({\frac {1-x-(1-(x+h))}{(1-(x+h))(1-x)}})\\\\&=&\lim _{h\to 0}{\frac {1}{h}}({\frac {h}{(1-(x+h))(1-x)}})\\\\&=&\lim _{h\to 0}{\frac {1}{(1-(x+h))(1-x)}}\\\\&=&{\frac {1}{(1-x)^{2}}}\end{matrix}}}
1. Differentiate
f
(
z
)
=
z
2
{\displaystyle f(z)=z^{2}}
2. Differentiate
f
(
z
)
=
(
1
−
z
)
2
{\displaystyle f(z)=(1-z)^{2}}
3. Differentiate from first principle
f
(
z
)
=
1
(
1
−
z
)
2
{\displaystyle f(z)={\frac {1}{(1-z)^{2}}}}
4. Differentiate
f
(
z
)
=
(
1
−
z
)
3
{\displaystyle f(z)=(1-z)^{3}}
5. Prove the result assumed in example 3 above, i.e. if
f (x )=g (x )+h (x )
then
f ′(x )=g ′(x )+h ′(x ).
Hint: use limits .
Differentiating f(z) = (1 - z)^n
edit
We aim to derive a vital result in this section, namely, to derive the derivative of
f
(
z
)
=
(
1
−
z
)
n
{\displaystyle f(z)=(1-z)^{n}}
where n ≥ 1 and n an integer. We will show a number of ways to arrive at the result.
Let's proceed:
f
(
z
)
=
(
1
−
z
)
n
{\displaystyle f(z)=(1-z)^{n}}
expand the right hand side using binomial expansion
f
(
z
)
=
1
−
(
n
1
)
z
+
(
n
2
)
z
2
+
.
.
.
+
(
−
1
)
n
z
n
{\displaystyle f(z)=1-{n \choose 1}z+{n \choose 2}z^{2}+...+(-1)^{n}z^{n}}
differentiate both sides
f
′
(
z
)
=
−
(
n
1
)
+
(
n
2
)
2
z
+
.
.
.
+
(
−
1
)
n
n
z
n
−
1
{\displaystyle f'(z)=-{n \choose 1}+{n \choose 2}2z+...+(-1)^{n}nz^{n-1}}
now we use
(
n
i
)
=
n
!
i
!
(
n
−
i
)
!
{\displaystyle {n \choose i}={\frac {n!}{i!(n-i)!}}}
f
′
(
z
)
=
−
n
!
1
!
(
n
−
1
)
!
+
n
!
2
!
(
n
−
2
)
!
2
z
+
.
.
.
+
(
−
1
)
n
n
z
n
−
1
{\displaystyle f'(z)=-{\frac {n!}{1!(n-1)!}}+{\frac {n!}{2!(n-2)!}}2z+...+(-1)^{n}nz^{n-1}}
and there are some cancelling
f
′
(
z
)
=
−
n
!
1
!
(
n
−
1
)
!
+
n
!
1
!
(
n
−
2
)
!
z
+
.
.
.
+
(
−
1
)
n
n
z
n
−
1
{\displaystyle f'(z)=-{\frac {n!}{1!(n-1)!}}+{\frac {n!}{1!(n-2)!}}z+...+(-1)^{n}nz^{n-1}}
take out a common factor of -n, and recall that 1! = 0! = 1 we get
f
′
(
z
)
=
−
n
(
1
+
n
−
1
!
1
!
(
n
−
2
)
!
z
+
.
.
.
+
(
−
1
)
n
−
1
z
n
−
1
)
{\displaystyle f'(z)=-n(1+{\frac {n-1!}{1!(n-2)!}}z+...+(-1)^{n-1}z^{n-1})}
let j = i - 1, we get
f
′
(
z
)
=
−
n
(
1
+
n
−
1
!
1
!
(
n
−
2
)
!
z
+
.
.
.
+
(
−
1
)
n
−
1
z
n
−
1
)
{\displaystyle f'(z)=-n(1+{\frac {n-1!}{1!(n-2)!}}z+...+(-1)^{n-1}z^{n-1})}
but this is just the expansion of (1 - z)n-1
f
′
(
z
)
=
−
n
(
1
−
z
)
n
−
1
{\displaystyle f'(z)=-n(1-z)^{n-1}}
Similar to Derivation 1, we use instead the definition of a derivative:
f
′
(
z
)
=
lim
h
→
0
(
1
−
(
z
+
h
)
)
n
−
(
1
−
z
)
n
h
{\displaystyle f'(z)=\lim _{h\to 0}{\frac {(1-(z+h))^{n}-(1-z)^{n}}{h}}}
expand using the binomial theorem
f
′
(
z
)
=
lim
h
→
0
∑
i
=
0
n
(
n
i
)
(
−
1
)
i
(
z
+
h
)
i
−
∑
i
=
0
n
(
n
i
)
(
−
1
)
i
z
i
h
{\displaystyle f'(z)=\lim _{h\to 0}{\frac {\sum _{i=0}^{n}{n \choose i}(-1)^{i}(z+h)^{i}-\sum _{i=0}^{n}{n \choose i}(-1)^{i}z^{i}}{h}}}
factorise
f
′
(
z
)
=
lim
h
→
0
∑
i
=
0
n
(
n
i
)
(
−
1
)
i
(
(
z
+
h
)
i
−
z
i
)
h
{\displaystyle f'(z)=\lim _{h\to 0}{\frac {\sum _{i=0}^{n}{n \choose i}(-1)^{i}((z+h)^{i}-z^{i})}{h}}}
take the limit inside (recall that [Af(x)]' = Af'(x) )
f
′
(
z
)
=
∑
i
=
0
n
(
n
i
)
(
−
1
)
i
lim
h
→
0
(
z
+
h
)
i
−
z
i
h
{\displaystyle f'(z)=\sum _{i=0}^{n}{n \choose i}(-1)^{i}\lim _{h\to 0}{\frac {(z+h)^{i}-z^{i}}{h}}}
the inside is just the derivative of zi
f
′
(
z
)
=
∑
i
=
1
n
(
n
i
)
(
−
1
)
i
i
z
i
−
1
{\displaystyle f'(z)=\sum _{i=1}^{n}{n \choose i}(-1)^{i}iz^{i-1}}
exactly as derivation 1, we get
f
′
(
z
)
=
−
n
(
1
−
z
)
n
−
1
{\displaystyle f'(z)=-n(1-z)^{n-1}}
Example
Differentiate (1 - z)2
Solution 1
f(z) = (1 - z)2 = 1 - 2z + z2
f'(z) = - 2 + 2z
f'(z) = - 2(1 - z)
Solution 2
By the result derived above we have
f'(z) = -2(1 - z)2 - 1 = -2(1 - z)
Imitate the method used above or otherwise, differentiate:
1. (1 - z)3
2. (1 + z)2
3. (1 + z)3
4. (Harder) 1/(1 - z)3 (Hint: Use definition of derivative)
Differentiation technique
edit
We will teach how to differentiate functions of this form:
f
(
z
)
=
1
g
(
z
)
{\displaystyle f(z)={\frac {1}{g(z)}}}
i.e. functions whose reciprocals are also functions. We proceed, by the definition of differentiation:
f
(
z
)
=
1
g
(
z
)
{\displaystyle f(z)={\frac {1}{g(z)}}}
f
′
(
z
)
=
lim
h
→
0
1
h
(
1
g
(
z
+
h
)
−
1
g
(
z
)
)
=
lim
h
→
0
1
h
(
g
(
z
)
−
g
(
z
+
h
)
g
(
z
+
h
)
g
(
z
)
)
=
lim
h
→
0
g
(
z
+
h
)
−
g
(
z
)
h
−
1
g
(
z
+
h
)
g
(
z
)
=
lim
h
→
0
g
′
(
z
)
−
1
g
(
z
+
h
)
g
(
z
)
=
−
g
′
(
z
)
g
(
z
)
2
{\displaystyle {\begin{matrix}f'(z)&=&\lim _{h\to 0}{\frac {1}{h}}({\frac {1}{g(z+h)}}-{\frac {1}{g(z)}})\\\\&=&\lim _{h\to 0}{\frac {1}{h}}({\frac {g(z)-g(z+h)}{g(z+h)g(z)}})\\\\&=&\lim _{h\to 0}{\frac {g(z+h)-g(z)}{h}}{\frac {-1}{g(z+h)g(z)}}\\\\&=&\lim _{h\to 0}g'(z){\frac {-1}{g(z+h)g(z)}}\\\\&=&-{\frac {g'(z)}{g(z)^{2}}}\\\end{matrix}}}
1
1
−
z
=
1
+
z
+
z
2
+
z
3
+
.
.
.
(
1
1
−
z
)
′
=
1
+
2
z
+
3
z
2
+
.
.
.
{\displaystyle {\begin{matrix}{\frac {1}{1-z}}&=&1+&z+z^{2}+z^{3}+...\\\\({\frac {1}{1-z}})'&=&&1+2z+3z^{2}+...\\\end{matrix}}}
by
(
1
g
)
′
=
−
g
′
g
2
{\displaystyle ({\frac {1}{g}})'={\frac {-g'}{g^{2}}}}
where g is a function of z , we get
1
(
1
−
z
)
2
=
1
+
2
z
+
3
z
2
+
.
.
.
{\displaystyle {\begin{matrix}{\frac {1}{(1-z)^{2}}}&=&&1+2z+3z^{2}+...\\\end{matrix}}}
which confirmed the result derived using a counting argument.
Differentiate
1. 1/(1-z)2
2. 1/(1-z)3
3. 1/(1+z)3
4. Show that (1/(1 - z)n )' = n/(1-z)n+1
Differentiation applied to generating functions
edit
Now that we are familiar with differentiation from first principle, we should consider:
f
(
z
)
=
1
1
−
x
2
{\displaystyle f(z)={\frac {1}{1-x^{2}}}}
we know
1
1
−
x
2
=
1
+
x
2
+
x
4
+
x
6
+
.
.
.
.
{\displaystyle {\frac {1}{1-x^{2}}}=1+x^{2}+x^{4}+x^{6}+....}
differentiate both sides
(
1
1
−
x
2
)
′
=
2
x
+
4
x
3
+
6
x
5
+
.
.
.
.
{\displaystyle {\begin{pmatrix}{\frac {1}{1-x^{2}}}\end{pmatrix}}'=2x+4x^{3}+6x^{5}+....}
2
x
(
1
−
x
2
)
2
=
2
x
(
1
+
2
x
2
+
3
x
4
+
.
.
.
.
)
{\displaystyle {\frac {2x}{(1-x^{2})^{2}}}=2x(1+2x^{2}+3x^{4}+....)}
therefore we can conclude that
1
(
1
−
x
2
)
2
=
1
+
2
x
2
+
3
x
4
+
.
.
.
.
{\displaystyle {\frac {1}{(1-x^{2})^{2}}}=1+2x^{2}+3x^{4}+....}
Note that we can obtain the above result by the substitution method as well,
1
(
1
−
z
)
2
=
1
+
2
z
+
3
z
2
+
.
.
.
.
{\displaystyle {\frac {1}{(1-z)^{2}}}=1+2z+3z^{2}+....}
letting z = x2 gives you the require result.
The above example demonstrated that we need not concern ourselves with difficult differentiations. Rather, to get the results the easy way, we need only to differentiate the basic forms and apply the substitution method. By basic forms we mean generating functions of the form:
1
(
1
−
z
)
n
{\displaystyle {\frac {1}{(1-z)^{n}}}}
for n ≥ 1.
Let's consider the number of solutions to
a
1
+
a
2
+
a
3
+
.
.
.
+
a
n
=
m
{\displaystyle a_{1}+a_{2}+a_{3}+...+a_{n}=m}
for ai ≥ 0 for i = 1, 2, ... n.
We know that for any m , the number of solutions is the coefficient to:
(
1
+
x
+
x
2
+
.
.
.
)
n
=
1
(
1
−
z
)
n
{\displaystyle (1+x+x^{2}+...)^{n}={\frac {1}{(1-z)^{n}}}}
as discussed before.
We start from:
1
1
−
z
=
1
+
x
+
x
2
+
.
.
.
+
x
n
+
.
.
.
{\displaystyle {\frac {1}{1-z}}=1+x+x^{2}+...+x^{n}+...}
differentiate both sides (note that 1 = 1!)
1
!
(
1
−
z
)
2
=
1
+
2
x
+
3
x
2
.
.
.
+
n
x
n
−
1
+
.
.
.
{\displaystyle {\frac {1!}{(1-z)^{2}}}=1+2x+3x^{2}...+nx^{n-1}+...}
differentiate again
2
!
(
1
−
z
)
3
=
2
+
2
×
3
x
.
.
.
+
n
(
n
−
1
)
x
n
−
2
+
.
.
.
{\displaystyle {\frac {2!}{(1-z)^{3}}}=2+2\times 3x...+n(n-1)x^{n-2}+...}
and so on for (n-1) times
(
n
−
1
)
!
(
1
−
z
)
n
=
(
n
−
1
)
!
+
n
!
1
!
x
+
(
n
+
1
)
!
2
!
x
2
+
(
n
+
2
)
!
3
!
x
3
+
.
.
.
{\displaystyle {\frac {(n-1)!}{(1-z)^{n}}}=(n-1)!+{\frac {n!}{1!}}x+{\frac {(n+1)!}{2!}}x^{2}+{\frac {(n+2)!}{3!}}x^{3}+...}
divide both sides by (n-1)!
1
(
1
−
z
)
n
=
1
+
n
!
(
n
−
1
)
!
1
!
x
+
(
n
+
1
)
!
(
n
−
1
)
!
2
!
x
2
+
(
n
+
2
)
!
(
n
−
1
)
!
3
!
x
3
+
.
.
.
{\displaystyle {\frac {1}{(1-z)^{n}}}=1+{\frac {n!}{(n-1)!1!}}x+{\frac {(n+1)!}{(n-1)!2!}}x^{2}+{\frac {(n+2)!}{(n-1)!3!}}x^{3}+...}
the above confirms the result derived using a counting argument.