# whos good at tossing a coin, / probability

#### Deleted member 115935

Joined Dec 31, 1969
0
Was just wondering as one does this early in the day,

if I toss a fair coin , 100 times,
it "should" ideally be 50 H and 50 T

what's the probability of it being 49H and 51 T
and going forward, 48H and 52T etc.

PLEASE. I know from experience on here, that some will ask all sorts of questions as to what its for, and come up with all sorts of what ifs, such as is the coin really fair, the amount of sun light on it will affect the results , etc etc.

Its just a thought experiment ...

#### MrChips

Joined Oct 2, 2009
30,925
Was just wondering as one does this early in the day,

if I toss a fair coin , 100 times,
it "should" ideally be 50 H and 50 T
You are committing a common mistake.

When you add the probability of 51 H and 49 T with the probability of 49 H and 51 T you will discover that 50H and 50 T is not the most probable outcome.

#### joeyd999

Joined Jun 6, 2011
5,355
Was just wondering as one does this early in the day,

if I toss a fair coin , 100 times,
it "should" ideally be 50 H and 50 T

what's the probability of it being 49H and 51 T
and going forward, 48H and 52T etc.

PLEASE. I know from experience on here, that some will ask all sorts of questions as to what its for, and come up with all sorts of what ifs, such as is the coin really fair, the amount of sun light on it will affect the results , etc etc.

Its just a thought experiment ...
We just had a thorough discussion -- part of which expounds on your exact question.

#### 402DF855

Joined Feb 9, 2013
271
Interesting question to me and while I reviewed the information at the link above, I don't see a specific answer to the question. I've run a quick simulation and the results are:

For 100 flips, the odds are:

50T/50H - About 7.89%
51T/49H - About 7.79%

It would be interesting to know the theoretical result as that would help evaluate the standard C PRN I'm using.

Last edited:

#### sagor

Joined Mar 10, 2019
914
What if the coin lands on the edge??? Odds of that are extremely low, but "possible"
Thought I'd throw that into the mix...

#### 402DF855

Joined Feb 9, 2013
271
In the same spirit I suppose playing Yahtzee in theory all five die could land perfectly balanced on a corner or side. How many points is that worth?

#### Deleted member 115935

Joined Dec 31, 1969
0
Thank you all,
I knew some one would come up with the suggestion, what about landing on edge,
lets not take this to stupid levels,

As was said at the very beginning,

its a pure thought experiment, worth a perfect coin,

As an aside, on this forum, there are a number of people who do seem to be good at taking anything into the worlds of improbability, no matter how clear the original question is.

Its almost to the point where its impossible to ask a question without having to filter all the *(*&*^& ....

#### Deleted member 115935

Joined Dec 31, 1969
0
We just had a thorough discussion -- part of which expounds on your exact question.

Thank you @joeyd999

I can rely upon you....

This is not related to any other thread,

its a pure thought experiment and I wanted to read around a bit more,

Probability and statistics is an interesting topic, I have no problem admitting I always want to learn / cross reference,
humans are very bad at statistics / probability,
a fair part IMHO seems to be related to the English language not being precise, and people reading what they want to read,

Again,
thank you for that probability link,
it certainly looks interesting and I want to read it a bit tonight,

#### Deleted member 115935

Joined Dec 31, 1969
0
You are committing a common mistake.

When you combine the probability of 51 H and 49 T with the probability of 49 H and 51 T you will discover that 50H and 50 T is not the most probable outcome.

Thank you @MrChips

Could you expand upon your thought please,

Just to reiterate,

Toss a fair coin 100 times, and count the number of H and T ,
what's the most likely number of H to have been seen then ?

Your maths would be interesting,

Thank you

#### Deleted member 115935

Joined Dec 31, 1969
0
Interesting question to me and while I reviewed the information at the link above, I don't see a specific answer to the question. I've run a quick simulation and the results are:

For 100 flips, the odds are:

50T/50H - About 7.89%
51T/49H - About 7.79%

It would be interesting to know the theoretical result as that would help evaluate the standard C PRN I'm using.
Thank you @402DF855

it does seem from a simple read through and a lot of old memories,
that there is a distribution of probabilities of number of H in 100 tosses.

I'm guessing its going to be a gaussian curve, but I have more reading on that yet.

Your comment highlights well the problem with the English language, its not designed to be exact.
Your dead right, its not 50%, but a probability.

#### 402DF855

Joined Feb 9, 2013
271
So, the binomial theorem applies here. Looks like the theoretical answer to likelihood of tails=50 for 100 flips is about 7.958924%. If my calculator is correct, the answer is to take the 50th binomial coefficient for n=100 and divide by 2 to the 100th power:

1.008913e+029 / 1.267651e+030 = 0.079589

#### MrChips

Joined Oct 2, 2009
30,925
Thank you @MrChips

Could you expand upon your thought please,

Just to reiterate,

Toss a fair coin 100 times, and count the number of H and T ,
what's the most likely number of H to have been seen then ?

Your maths would be interesting,

Thank you
The probability of 50 H and 50 T in 100 flips is 7.959%
The probability of 51 H and 49 T is 7.803%
The probability of 49 H and 51 T is 7.803%

Hence the probability of a 49/51 split is 15.606%
It is two times more likely to have a 49/51 split than a 50/50 split.

#### bogosort

Joined Sep 24, 2011
696
It would be interesting to know the theoretical result as that would help evaluate the standard C PRN I'm using.
Flipping a coin is a Bernoulli process. A sequence of coin flips leads to a binomial distribution, and so the underlying probabilities are represented by binomial coefficients. For a fair coin, these coefficients are given by $C(n, r) = \frac{n!}{r!(n - r)!}$ where $$n$$ is the number of trials and $$r$$ the number of successes (e.g., flipping "heads"). Intuitively, this is the number of ways (combinations) to choose $$r$$ distinct subsets from a set of $$n$$ things.

The binomial distribution is the discrete version of the normal (Gaussian) distribution, and so it is symmetric about the mean -- i.e., we can replace "heads" as a success with "tails" and get the same coefficients. To convert to a probability, we simply multiply the binomial coefficient by the probability of drawing any particular sequence: $$1 / 2^n$$.

So, with $$n = 100$$ and $$r = 50$$ heads, we have $\frac{1}{2^{100}} \times C(100, 50) = 0.079589...$ In other words, the likelihood of flipping 50 heads in 100 tosses is a little less than 8%. You can plug the equation into Wolfram Alpha to get the probability for any number of heads/tails you like, e.g., inputting "1/2^100 * C(100, 51)", Wolfram tells us that the probability is a little bigger than 0.70828.

#### Deleted member 115935

Joined Dec 31, 1969
0
The probability of 50 H and 50 T in 100 flips is 7.959%
The probability of 51 H and 49 T is 7.803%
The probability of 49 H and 51 T is 7.803%

Hence the probability of a 49/51 split is 15.606%
It is two times more likely to have a 49/51 split than a 50/50 split.

Thanks @MrChips,
That makes sense, it depends what question you ask.

Its more likely to have 50 H in 100 , than it is to have 49 H ( 0.079 v 0.078 )

Its more likely to have a 49:50 split than it is that you have 50:50 split ( 0.156 v 0.079 )

#### hrs

Joined Jun 13, 2014
410
I noticed there's a built-in function for combinations in recent versions of Python:
Help on built-in function comb in module math:

comb(n, k, /)
Number of ways to choose k items from n items without repetition and without order.

Evaluates to n! / (k! * (n - k)!) when k <= n and evaluates
to zero when k > n.

Also called the binomial coefficient because it is equivalent
to the coefficient of k-th term in polynomial expansion of the
expression (1 + x)**n.

Raises TypeError if either of the arguments are not integers.
Raises ValueError if either of the arguments are negative.
Here's some output of probabilities in %:
Code:
>>> from math import comb
>>> n = 100
>>> [print(k, 100*comb(n, k)/2**n) for k in range(n+1)]
0 7.888609052210118e-29
1 7.888609052210118e-27
2 3.9048614808440084e-25
3 1.2755880837423761e-23
4 3.093301103075262e-22
5 5.939138117904503e-21
6 9.403635353348797e-20
7 1.2627738903068384e-18
8 1.4679746474816996e-17
9 1.5005963063146263e-16
10 1.36554263874631e-15
11 1.1172621589742536e-14
12 8.286361012392381e-14
13 5.609228993004073e-13
14 3.4857351599382456e-12
15 1.998488158364594e-11
16 1.0616968341311906e-10
17 5.246031415707059e-10
18 2.4190033750204775e-09
19 1.0439909302719956e-08
20 4.228163267601582e-08
21 1.6107288638482217e-07
22 5.783980920182251e-07
23 1.96152396423572e-06
24 6.293222718589601e-06
25 1.9131397064512387e-05
26 5.518672230147804e-05
27 0.00015125249815960647
28 0.0003943368702018312
29 0.0009790432639493738
30 0.002317069058013518
31 0.0052320914213208475
32 0.011281697127223078
33 0.023247133474277856
34 0.045810527728724015
35 0.08638556657416528
36 0.15597393964779843
37 0.26979276047186757
38 0.44728799762441196
39 0.711073226992655
40 1.0843866711637988
41 1.5869073236543396
42 2.2292269546572867
43 3.0068642644214565
44 3.895255978909614
45 4.8474296626430755
46 5.795839814029764
47 6.659049999098027
48 7.352701040670738
49 7.802866410507722
50 7.958923738717876
51 7.802866410507722
52 7.352701040670738
53 6.659049999098027
54 5.795839814029764
55 4.8474296626430755
56 3.895255978909614
57 3.0068642644214565
58 2.2292269546572867
59 1.5869073236543396
60 1.0843866711637988
61 0.711073226992655
62 0.44728799762441196
63 0.26979276047186757
64 0.15597393964779843
65 0.08638556657416528
66 0.045810527728724015
67 0.023247133474277856
68 0.011281697127223078
69 0.0052320914213208475
70 0.002317069058013518
71 0.0009790432639493738
72 0.0003943368702018312
73 0.00015125249815960647
74 5.518672230147804e-05
75 1.9131397064512387e-05
76 6.293222718589601e-06
77 1.96152396423572e-06
78 5.783980920182251e-07
79 1.6107288638482217e-07
80 4.228163267601582e-08
81 1.0439909302719956e-08
82 2.4190033750204775e-09
83 5.246031415707059e-10
84 1.0616968341311906e-10
85 1.998488158364594e-11
86 3.4857351599382456e-12
87 5.609228993004073e-13
88 8.286361012392381e-14
89 1.1172621589742536e-14
90 1.36554263874631e-15
91 1.5005963063146263e-16
92 1.4679746474816996e-17
93 1.2627738903068384e-18
94 9.403635353348797e-20
95 5.939138117904503e-21
96 3.093301103075262e-22
97 1.2755880837423761e-23
98 3.9048614808440084e-25
99 7.888609052210118e-27
100 7.888609052210118e-29

#### 402DF855

Joined Feb 9, 2013
271
Can it handle large N? For throwing 5000 tails in 10K flips I get about 0.797865%.

#### hrs

Joined Jun 13, 2014
410
Can it handle large N? For throwing 5000 tails in 10K flips I get about 0.797865%.
Are you replying to me? If so, the following works but is starting to get a bit sluggish taking a few seconds to execute:
Code:
>>> [comb(2*k, k)/2**(2*k) for k in range(5000, 100000, 5000)]
[0.007978646139382154, 0.00564182531222042, 0.004606550271538934, 0.003989397870199723, 0.003568230391108985, 0.003257336507089078, 0.0030157094050505726, 0.0028209391022903127, 0.0026596
078148664716, 0.00252312621419674, 0.002405706999932981, 0.002303289531284048, 0.002212929356574681, 0.0021324323783108697, 0.00206012564391141, 0.0019947082852730326, 0.00193515146079856
55, 0.0018806293331721888, 0.0018304703120906492]