1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Binomial distribution

  1. Sep 29, 2014 #1
    1. The problem statement, all variables and given/known data
    You throw a coin a 100 times, what's the probability of getting 50 tails?

    2. Relevant equations
    1d53e4a0d17e17adfeb7f53ecca9df5d.png
    977b495e5d962b18db3c56fdabf2cbc6.png

    3. The attempt at a solution
    We have n=100 , p=1/2, q=1/2 and k=50 we substitute in the first equation we get:
    P= 100!/ (50! * 50!) * (1/2)^100
    The factorials are not simple to calculate so i used Stirling formula ( logarithmic approximation) and i found that Log P=0 so P=1 which i think is incorrect because 1 is the sum of all the probabilities...so where is my mistake?
     
  2. jcsd
  3. Sep 29, 2014 #2

    statdad

    User Avatar
    Homework Helper

    Log p? I'm not sure what expression it is you calculated the log of. Try this:
    Since
    [tex] \binom{100}{50} = \dfrac{100!}{50! \cdot 50!}
    [/tex]
    its logarithm is
    [tex]
    \log{100!} - \log{50! \cdot 50!} = \log{100!} - \left(\log 50! + \log 50!\right) = \log{100!} - 2\log{50!}
    [/tex]

    use the approximation to work that out, then go back and finish the calculation. (Or, you can use Wolfram Alpha to get the coefficient). It is possible that the intent of the problem is to use the normal approximation, but unless that is specifically requested ...
     
  4. Sep 29, 2014 #3

    Orodruin

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Gold Member

    I suggest not using the Stirling formula. Computing those factorials relatively accurately should not be a big problem for a computer.

    Edit: To clarify, the Stirling formula is not accurate enough for this problem. In order to get something more reasonable you need to include the next term of the approximation as well:
    $$
    \ln(n!) \simeq n(\ln n - 1) + \frac 12 \ln(2\pi n)
    $$
     
    Last edited: Sep 29, 2014
  5. Sep 29, 2014 #4
    That's exactly what i did but in order to get that i had to introduce the Log in both sides of the equation, that's why i got Log P
     
  6. Sep 29, 2014 #5
    I used the next term too and i got a negative result !!! I got 1/2 Log2 - 1/2 Log 100π !!!!
     
  7. Sep 29, 2014 #6

    Orodruin

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Gold Member

    Then I suggest you redo the algebra. The ##100\log(1/2)## term should cancel with the leading terms from the Stirling approximation and you should be left with the correction terms from ##\ln(100!)## and ##2\ln(50!)##. Do note that the result for ##\ln(P)## should be negative as long as the probability is smaller than 1. I tried this problem both by computing the factorials and by using the correction to the Stirling formula. Both gave similar results.
     
  8. Sep 29, 2014 #7
    oh yes yes that's ok i found P=0.08 ...that was Log P which is negative sorry ...Thank you
     
  9. Sep 29, 2014 #8
    Just a question, How can we know that we should get to next term of the approximation ( without calculating and finding a wrong result)?
     
  10. Sep 29, 2014 #9

    Orodruin

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Gold Member

    A priori we do not. In order to know we must know how the next term in the series behaves (in this case as ln(n)) and compare to the contribution of the previous terms. The thing to note here is that as was the case in this problem, terms from different contributions might cancel out to leading order and then you really have to go to the next order in the expansion. Another example of this would be ##f(x) = e^x - e^{-x}## for small ##x##. In that situation we would have ##f(x) \simeq 0## close to ##x = 0## due to ##e^x \simeq 1##. However, as soon as you go to the first order correction, you would obtain ##e^x \simeq 1+x## and thus
    $$
    f(x) \simeq (1+x) - (1-x) = 2x.
    $$
     
  11. Sep 29, 2014 #10

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    I'm not sure what your "next term" would be, but there is a very simple correction to Stirling that gives an upper bound on ##n!##:
    [tex] \text{St}(n) < n! < \text{St1}(n) \\
    \text{where} \\
    \text{St}(n) = \sqrt{2 \pi n} n^n e^{-n}, \;
    \text{St1}(n) = \sqrt{2 \pi n} n^n e^{-n + \frac{1}{12n}}
    [/tex]
    If we call St1(n) the corrected Stirling, it gives much better accuracy, even for small ##n##:
    [tex]
    \begin{array}{cccc}
    n & n! & \text{Stirling} & \text{Corrected Stirling}\\
    1 & 1 & 0.922137 & 1.002274\\
    2 & 2 & 1.919004 & 2.000652 \\
    5 & 120 & 118.0192 & 120.0026 \\
    10 & 3628800 & 3598696 & 3628810 \\
    15 & 1.307674e+12 & 1.300431e+12 & 1.307675e+12 \\
    20 & 2.432902e+18 & 2.422787e+18 & 2.432903e+18 \\
    25 & 1.551121e+25 & 1.545959e+25 & 1.551121e+25 \\
    30 & 2.652529e+32 & 2.645171e+32 & 2.652529e+32
    \end{array}
    [/tex]
    Note that
    [tex] \log(\text{St1}(n)) = \frac{1}{2} \log(2 \pi) +\frac{1}{2} \log(n) + n \log(n) - n + \frac{1}{12n} [/tex]
    Was that the "correction" you cited?
     
  12. Sep 29, 2014 #11
    So the corrected stirling is the most accurate formula to use if we want better precision?
     
  13. Sep 29, 2014 #12

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    I would not bother in this problem: P0 = 0.07958923737, P1 = 0.07978845606 and P2 = 0.07958923413, where P0 = exact, P1 uses Stirling and P2 uses corrected Stirling. To 3 digits we have P0 = 0.0796, P1 = 0.0798 and P2 = 0.0796.

    The differences would be more significant in smaller problems, such as for n near 20 instead of 100.
     
  14. Sep 29, 2014 #13

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    I just realized that what you call "Stirling" and what I call "Stirling" are very different. Your Stirling is essentially ##\log(n!) \sim n \log(n) - n##, which is true, but fails when exponentiated: ## n ! \not\sim n^n e^{-n}## ! What I (and essentially all modern textbooks) call Stirling is ##\log(n!) \sim \frac{1}{2} \log(2 \pi) + \frac{1}{2} \log(n) + n \log(n) - n##. That is true, and also leads to a true result when exponentiated: ##n! \sim \sqrt{2 \pi n} n^n e^{-n}##. What I called the "corrected" Stirling gives results that are even better.

    So, when I said it would be OK to use Stirling (uncorrected) I meant the standard Stirling that includes the ##\sqrt{2 \pi n}## factor, not your "bad" Stirling that omits it!
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Binomial distribution
  1. Binomial Distribution (Replies: 1)

  2. Binomial Distribution (Replies: 2)

  3. Binomial Distribution (Replies: 1)

  4. Binomial distribution (Replies: 5)

  5. Binomial distribution. (Replies: 1)

Loading...