77
Stirling’s Formula: an Approximation of the Factorial Eric Gilbertson

Stirling’s Formula: an Approximation of the Factorial · • Stirling’s formula. ... (a,b) if the function Is a monotonically increasing function of on the interval 1 2 1 2

  • Upload
    buikhue

  • View
    225

  • Download
    1

Embed Size (px)

Citation preview

Stirling’s Formula: an Approximation of the Factorial

Eric Gilbertson

Outline

• Introduction of formula• Convex and log convex functions• The gamma function• Stirling’s formula

Outline

• Introduction of formula• Convex and log convex functions• The gamma function• Stirling’s formula

Introduction of Formula

In the early 18th century James Stirling proved the following formula:

For some

nnn enn 12/2/12! θπ +−+=10 << θ

Introduction of Formula

In the early 18th century James Stirling proved the following formula:

For some

This means that as

nnn enn 12/2/12! θπ +−+=10 << θ

nn enn −+ 2/12~! π

∞→n

Outline

• Introduction of formula• Convex and log convex functions• The gamma function• Stirling’s formula

Convex Functions

A function f(x) is called convex on the interval (a,b) if the function

Is a monotonically increasing function of on the interval

21

2121

)()(),(xx

xfxfxx−−

1x

2x

A function f(x) is called convex on the interval (a,b) if the function

Is a monotonically increasing function of on the interval

Ex: is convexis not convex on the interval (-1,0)

Convex Functions

21

2121

)()(),(xx

xfxfxx−−

1x

3x

Convex Functions - Properties

If f(x) and g(x) are convex then f(x)+g(x) is also convex

If f(x) is twice differentiable and the second derivative of f is positive on an interval, then f(x) is convex on the interval

Log Convex Functions

A positive-valued function f(x) is called log convex on the interval (a,b) if the function is convex on the interval.

)(ln xf

Log Convex Functions

A positive-valued function f(x) is called log convex on the interval (a,b) if the function is convex on the interval.

Ex: is log convex

)(ln xf

2xe

Log Convex Functions -Properties

The product of log convex functions is log convex

Log Convex Functions -Properties

The product of log convex functions is log convexIf f(t,x) is a log convex function twice differentiable in

x, for t in the interval [a,b] and x in any interval then

is a log convex function of x∫b

adtxtf ),(

Log Convex Functions -Properties

The product of log convex functions is log convexIf f(t,x) is a log convex function twice differentiable in

x, for t in the interval [a,b] and x in any interval then

is a log convex function of x

Ex: is log convexdtteb

a

xt∫ −− 1

∫b

adtxtf ),(

Outline

• Introduction of formula• Convex and log convex functions• The gamma function• Stirling’s formula

The Gamma Function

An extension of the factorial to all positive real numbers is the gamma function where

∫∞ −−=Γ

0

1)( dttex xt

The Gamma Function

An extension of the factorial to all positive real numbers is the gamma function where

Using integration by parts, for integer n

∫∞ −−=Γ

0

1)( dttex xt

)!1()( −=Γ nn

The Gamma Function -Properties

• The Gamma function is log convexthe integrand is twice differentiable on ),0[ ∞

The Gamma Function -Properties

• The Gamma function is log convexthe integrand is twice differentiable on

• And

),0[ ∞

1)1(0

==Γ ∫∞

− dte t

The Gamma Function -Uniqueness

Theorem: If a function f(x) satisfies the following three conditions then it is identical to the gamma function.

The Gamma Function -Uniqueness

Theorem: If a function f(x) satisfies the following three conditions then it is identical to the gamma function.

(1) f(x+1) = f(x)

The Gamma Function -Uniqueness

Theorem: If a function f(x) satisfies the following three conditions then it is identical to the gamma function.

(1) f(x+1) = f(x)(2) The domain of f contains all x>0 and f(x)

is log convex

The Gamma Function -Uniqueness

Theorem: If a function f(x) satisfies the following three conditions then it is identical to the gamma function.

(1) f(x+1) = f(x)(2) The domain of f contains all x>0 and f(x)

is log convex(3) f(1)=1

The Gamma Function -Uniqueness

Proof: Suppose f(x) satisfies the three properties. Then since f(1)=1 and f(x+1)=xf(x), for integer n≥2,

f(x+n)=(x+n-1)(x+n-2)…(x+1)xf(x)f(n) = (n-1)!

The Gamma Function -Uniqueness

Proof: suppose f(x) satisfies the three properties. Then since f(1)=1 and f(x+1)=xf(x), for integer n ≥ 2,

f(x+n)=(x+n-1)(x+n-2)…(x+1)xf(x).f(n) = (n-1)!Now if we can show Γ(x) and f(x) agree on

[0,1], then by these properties they agree everywhere.

The Gamma Function -Uniqueness

By property (2) f(x) is log convex, so by definition of convexity

nnnfnf

nnxnfnxf

nnnfnf

−+−+

≤−+−+

≤−+−−+−

)1()(ln)1(ln

)()(ln)(ln

)1()(ln)1(ln

The Gamma Function -Uniqueness

By property (2) f(x) is log convex, so by definition of convexity

nnnfnf

nnxnfnxf

nnnfnf

−+−+

≤−+−+

≤−+−−+−

)1()(ln)1(ln

)()(ln)(ln

)1()(ln)1(ln

nx

nnxfn ln)!1ln()(ln)1ln( ≤−−+

≤−

The Gamma Function -Uniqueness

By property (2) f(x) is log convex, so by definition of convexity

nnnfnf

nnxnfnxf

nnnfnf

−+−+

≤−+−+

≤−+−−+−

)1()(ln)1(ln

)()(ln)(ln

)1()(ln)1(ln

nx

nnxfn ln)!1ln()(ln)1ln( ≤−−+

≤−

])!1(ln[)(ln])!1()1ln[( −≤+≤−− nnnxfnn xx

The Gamma Function -Uniqueness

By property (2) f(x) is log convex, so by definition of convexity

The logarithm is monotonic so

nnnfnf

nnxnfnxf

nnnfnf

−+−+

≤−+−+

≤−+−−+−

)1()(ln)1(ln

)()(ln)(ln

)1()(ln)1(ln

nx

nnxfn ln)!1ln()(ln)1ln( ≤−−+

≤−

])!1(ln[)(ln])!1()1ln[( −≤+≤−− nnnxfnn xx

)!1()()!1()1( −≤+≤−− nnnxfnn xx

The Gamma Function -Uniqueness

Since f(x+n)=x(x+1)…(x+n-1)f(x) then

)!1()()1)...(1()!1()1( −≤−++≤−− nnxfnxxxnn xx

The Gamma Function -Uniqueness

Since f(x+n)=x(x+1)…(x+n-1)f(x) then

)!1()()1)...(1()!1()1( −≤−++≤−− nnxfnxxxnn xx

nnxxnxnn

nxxxnnxf

xx

nxxxnn x

)...()(!

)1)...(1()!1()()1)...(1(

)!1()1(

++

=−++

−≤≤−++

−−

The Gamma Function -Uniqueness

Since f(x+n)=x(x+1)…(x+n-1)f(x) then

Since this holds for n ≥ 2, we can replace n by n+1 on the right. Then

)!1()()1)...(1()!1()1( −≤−++≤−− nnxfnxxxnn xx

nnxxnxnn

nxxxnnxf

xx

nxxxnn x

)...()(!

)1)...(1()!1()()1)...(1(

)!1()1(

++

=−++

−≤≤−++

−−

nnxxxnxnnxf

nxxxnn xx

))...(1()(!)(

))...(1(!

+++

≤≤++

The Gamma Function -Uniqueness

This simplifies to )(

))...(1(!)( xf

nxxxnn

nxnxf

x

≤++

≤+

The Gamma Function -Uniqueness

This simplifies to

As n goes to infinity,)(

))...(1(!)( xf

nxxxnn

nxnxf

x

≤++

≤+

))...(1(!)( lim nxxx

nnxfx

n ++=

∞→

The Gamma Function -Uniqueness

This simplifies to

As n goes to infinity,

Since Gamma(x) satisfies the 3 properties of the theorem, then it satisfies this limit also.

Thus Γ(x) = f(x)

))...(1(!)(

)())...(1(

!)(

lim nxxxnnxf

xfnxxx

nnnx

nxf

x

n

x

++=

≤++

≤+

∞→

)())...(1(

!)( xfnxxx

nnnx

nxfx

≤++

≤+

))...(1(!)( lim nxxx

nnxfx

n ++=

∞→

Outline

• Introduction of formula• Convex and log convex functions• The gamma function• Stirling’s formula

Stirling’s Formula

Goal: Find upper and lower bounds for Γ(x)

Stirling’s Formulas

Goal: Find upper and lower bounds for Γ(x)From the definition of e, for k=1,2,…,(n-1)

1)/11()/11( ++≤≤+ kk kek

Stirling’s Formulas

Goal: Find upper and lower bounds for Gamma(x)From the definition of e, for k=1,2,…,(n-1)

Multiply all of these together to get

1)/11()/11( ++≤≤+ kk kek

...)21()

1(...)

21()

1( 1121 −−−−

−−

−≤≤

−−

−nnnnn

nn

nne

nn

nn

Stirling’s Formula

Simplifying,

nnnn eenneen −+− ≤≤ 1!

Stirling’s Formula

Simplifying,

nnnn eenneen −+− ≤+Γ≤⇒ 1)1(

nnnn eenneen −+− ≤≤ 1!

Stirling’s Formula

Simplifying,

Guess a function to approximate Γ(x)

nnnn eenneen −+− ≤+Γ≤⇒ 1)1(

)(2/1)( xxx eexxf μ−−=

nnnn eenneen −+− ≤≤ 1!

Stirling’s Formula

μ(x) must be chosen so that(1) f(x+1)=xf(x)(2) f(x) is log convex(3) f(1)=1

Stirling’s Formula

μ(x) must be chosen so that(1) f(x+1)=xf(x)(2) f(x) is log convex(3) f(1)=1

(1) Is equivalent to f(x+1)/f(x)=x

Stirling’s Formulas

Simplifying f(x+1)/f(x) gives

xeex xxx =+ −+−+ )()1(12/1)/11( μμ

Stirling’s Formulas

Simplifying f(x+1)/f(x) gives

)(1)/11ln()2/1()()1( xgxxxx ≡−++=−+⇒ μμ

xeex xxx =+ −+−+ )()1(12/1)/11( μμ

Stirling’s Formulas

Simplifying f(x+1)/f(x) gives

Then satisfies the equation

)(1)/11ln()2/1()()1( xgxxxx ≡−++=−+⇒ μμ

∑∞

=

+=0

)()(n

nxgxμ

)()()1(0 0

xgnxgnxgn n

=+−++∑ ∑∞

=

=

xeex xxx =+ −+−+ )()1(12/1)/11( μμ

Stirling’s Formula

Consider the Taylor expansionwith...

531]

11ln[2/1

53

+++=−+ yyy

yy

121+

=x

y

Stirling’s Formula

Consider the Taylor expansionwith...

531]

11ln[2/1

53

+++=−+ yyy

yy

121+

=x

y

...)12(3

112

1)/11ln(2/1 3 +++

+=+⇒

xxx

Stirling’s Formula

Consider the Taylor expansionwith...

531]

11ln[2/1

53

+++=−+ yyy

yy

121+

=x

y

...)12(3

112

1)/11ln(2/1 3 +++

+=+⇒

xxx

...)12(5

1)12(3

1)(1)/11ln()2/1( 42 ++

++

==−++⇒xx

xgxx

Stirling’s Formula

Consider the Taylor expansionwith

Replacing the denominators with all 3’s gives

...531

]11ln[2/1

53

+++=−+ yyy

yy

121+

=x

y

...)12(3

112

1)/11ln(2/1 3 +++

+=+⇒

xxx

...)12(5

1)12(3

1)(1)/11ln()2/1( 42 ++

++

==−++⇒xx

xgxx

...)12(3

1)12(3

1)( 42 ++

++

≤xx

xg

Stirling’s Formula

g(x) is a geometric series, thus

)1(121

121

)12(11

1)12(3

1)(2

2 +−=

+−+

≤xx

xx

xg

Stirling’s Formula

g(x) is a geometric series, thus

))1(12

1)(12

1()()(00 ++

−+

≤+= ∑∑∞

=

= nxnxnxgx

nn

μ

)1(121

121

)12(11

1)12(3

1)(2

2 +−=

+−+

≤xx

xx

xg

Stirling’s Formula

g(x) is a geometric series, thus

))1(12

1)(12

1()()(00 ++

−+

≤+= ∑∑∞

=

= nxnxnxgx

nn

μ

)1(121

121

)12(11

1)12(3

1)(2

2 +−=

+−+

≤xx

xx

xg

x121

=

Stirling’s Formula

Since g(x) is positive then x

x12

1)(0 << μ

Stirling’s Formula

Since g(x) is positive then

for some

xx

121)(0 << μ

⇒x

x12

)( θμ = 10 << θ

Stirling’s Formula

Since g(x) is positive then

for someFor property (2) we need to show f(x) is log convex

xx

121)(0 << μ

⇒x

x12

)( θμ = 10 << θ

Stirling’s Formula

Since g(x) is positive then

for someFor property (2) we need to show f(x) is log convexThis meansmust be convex.

xx

121)(0 << μ

⇒x

x12

)( θμ = 10 << θ

)(ln)21()(ln xxxxxf μ+−−=

Stirling’s Formula

is convex because g(x) is the sum of convex functions

)(xμ

Stirling’s Formula

is convex because g(x) is the sum of convex functions

is convex since its second

derivative is positive for positive x.

)(xμ

xxx −− ln)2/1(

2211xx

+

Stirling’s Formula

is convex because g(x) is the sum of convex functions

is convex since its second

derivative is positive for positive x.

Thus f(x) is log convex.

)(xμ

xxx −− ln)2/1(

2211xx

+

Stirling’s Formulas

For property (3) we need f(1)=1 so thatxxx eaxx 12/2/1)( θ+−−=Γ

Stirling’s Formulas

For property (3) we need f(1)=1 so that

Consider the function

)2

1()2/(2)( +ΓΓ=

xxxh x

xxx eaxx 12/2/1)( θ+−−=Γ

Stirling’s Formulas

For property (3) we need f(1)=1 so that

Consider the function

h(x) is log convex since the second derivative of is nonnegative and the gamma function is log convex.

)2

1()2/(2)( +ΓΓ=

xxxh x

xxx eaxx 12/2/1)( θ+−−=Γ

x2ln

Stirling’s Formula

)12/()2

1(2)1( 1 +Γ+

Γ=+ + xxxh x

Stirling’s Formula

)12/()2

1(2)1( 1 +Γ+

Γ=+ + xxxh x

)2

1()2/(22

2 +ΓΓ=

xxx x

Stirling’s Formula

)12/()2

1(2)1( 1 +Γ+

Γ=+ + xxxh x

)2

1()2/(22

2 +ΓΓ=

xxx x

)()1( xxhxh =+⇒

Stirling’s Formula

)12/()2

1(2)1( 1 +Γ+

Γ=+ + xxxh x

)2

1()2/(22

2 +ΓΓ=

xxx x

)()1( xxhxh =+⇒This means h(x) satisfies properties (1) and (2) of the uniqueness theorem, thus

)()( 2 xaxh Γ= for some constant 2a

Stirling’s Formula

Setting x=1 gives

)1()1()2/1(2)1( 2Γ=ΓΓ= ah

Stirling’s Formula

Setting x=1 gives

)1()1()2/1(2)1( 2Γ=ΓΓ= ah)1()2/1(22 ΓΓ=⇒ a

Stirling’s Formula

Setting x=1 gives

Using the limit equation for the gamma function

)1()1()2/1(2)1( 2Γ=ΓΓ= ah)1()2/1(22 ΓΓ=⇒ a

)!22(2!

lim2122/3

)1()2/1(2+

+=ΓΓ

∞→ nnn n

n

Stirling’s Formula

2/1

22

2 )!2(2)!(lim2nn

nan

n ∞→=

Stirling’s Formula

2/1

22

2 )!2(2)!(lim2nn

nan

n ∞→=

2/124/22/12

212/22122

])2([2][

2

1

lim2 neenaeena

nnn

nnnn

θ

−+

−+

∞→

=

Stirling’s Formula

2/1

22

2 )!2(2)!(lim2nn

nan

n ∞→=

2/124/22/12

212/22122

])2([2][

2

1

lim2 neenaeena

nnn

nnnn

θ

−+

−+

∞→

=

nn

nea 24/12/2 21lim2 θθ −

∞→=

Stirling’s Formula

2/1

22

2 )!2(2)!(lim2nn

nan

n ∞→=

2/124/22/12

212/22122

])2([2][

2

1

lim2 neenaeena

nnn

nnnn

θ

−+

−+

∞→

=

nn

nea 24/12/2 21lim2 θθ −

∞→=

2)2/1(22 aa =Γ=⇒

Stirling’s Formula

2/1

22

2 )!2(2)!(lim2nn

nan

n ∞→=

2/124/22/12

212/22122

])2([2][

2

1

lim2 neenaeena

nnn

nnnn

θ

−+

−+

∞→

=

nn

nea 24/12/2 21lim2 θθ −

∞→=

2)2/1(22 aa =Γ=⇒ π2)2/1(2 =Γ=⇒ a

Stirling’s Formula

Substituting a in the formula for f gives Stirling’sfinal result:

for some

nnn enn 12/2/12! θπ +−+=

10 << θ