CITE THIS NOTEBOOK: Word problems with discrete distributions with applications for coins, dice by Peter Burbery. Wolfram Community DEC 12 2022.
I used Mathematica to work through several examples of discrete distributions. I used the most general cases possible. My focus on generalization meant I didn’t include the Bernoulli distribution or the geometric distribution, which are special cases of the the Binomial distribution and the negative binomial distribution, respectively.

Binomial Distribution

What’s the probability you will have 110 heads out of 2 00 coin tosses?
In[]:=
Probabilityx==110,xBinomialDistribution200,
1
2

Out[]=
522222081148488803833122500948439092033029510866275025575
25108406941546723055343157692830665664409421777856138051584
In[]:=
NProbabilityx==110,xBinomialDistribution200,
1
2
,WorkingPrecision->100
Out[]=
0.02079869433231031517558728371841005445768414097750047505022048008924276263789036205146574846025135596
What’s the probability you will have between 96 and 108 heads out of 2 00 coin tosses?
In[]:=
Probability96<=x<=108,xBinomialDistribution200,
1
2

Out[]=
3911045678877858479058581704940733125002017822953426773745
6277101735386680763835789423207666416102355444464034512896
In[]:=
NProbability96<=x<=108,xBinomialDistribution200,
1
2
,WorkingPrecision->100
Out[]=
0.6230655235089846805722325124602419646326044754620131215351757111539208666562609916548872155987871016

Different value for p

The probability of getting 10 out of 70 sixes:
In[]:=
Probabilityx==10,xBinomialDistribution70,
1
6

Out[]=
43010790698981560264968493356718681752681732177734375
369400551818460155582338457473806922708916165381455872
In[]:=
NProbabilityx==10,xBinomialDistribution70,
1
6
,WorkingPrecision->100
Out[]=
0.1164340185396338386510498230883484677507515388618920536719888827877847141091800618609411721395454844
The probability of getting between 12 and 60 sixes:
In[]:=
Probability12<=x<=60,xBinomialDistribution70,
1
6

Out[]=
187259069812181268064657770604381223577766417255859375
369400551818460155582338457473806922708916165381455872
In[]:=
NProbability12<=x<=60,xBinomialDistribution70,
1
6
,WorkingPrecision->100
Out[]=
0.5069268816474554030716964137396395963756543473173258267098037954010037388889134982242586357972781571

Conditional probability

Fair coin

Find the probability of getting between 96 and 108 heads while tossing a coin 200 times given that between 84 and 120 heads have been scored.
In[]:=
Probability96<=x<=10884<=x<=120,xBinomialDistribution200,
1
2

Out[]=
11628989391050479264
18449216239063865589
In[]:=
NProbability96<=x<=10884<=x<=120,xBinomialDistribution200,
1
2
,WorkingPrecision->200
Out[]=
0.63032430431530068809899692345637817699678328822688987423451234841065472237923289930818501311173802387652995237308570370405266806550877430295020304057231993751711686954627743054145416963699253655539679

Dice

Find the probability of getting between 16 and 18 sixes when rolling a die 200 times given that between 14 and 20 sixes have been scored.
In[]:=
Probability16<=x<=2014<=x<=20,xBinomialDistribution200,
1
6

Out[]=
36193145699
36895670699
In[]:=
NProbability16<=x<=2014<=x<=20,xBinomialDistribution200,
1
6
,WorkingPrecision->100
Out[]=
0.9809591481414907345251618026427464239765872157997276145409582597597543675973819434483781302679606291

NegativeBinomial

The number of tails before getting 150 heads with a fair coin is modeled by the negative binomial distribution with n=150 and p=0.5
In[]:=
=NegativeBinomialDistribution150,
1
2

Out[]=
NegativeBinomialDistribution150,
1
2

Make a picture:
In[]:=
DiscretePlot[PDF[,k],{k,100,200},ImageSize->Full]
Out[]=
120
140
160
180
200
0.005
0.010
0.015
0.020
Find the probability of getting 144 tails before getting 150 heads:
In[]:=
Probability[x==144,x]//TraditionalForm
Out[]//TraditionalForm=
177581905345755788536968927329795127320244431122016245473913189034720070489983603588925
7957171782556586274486115970349133441607298412757563479047423630290551952200534008528896
In[]:=
NProbability[x==144,x,WorkingPrecision->150]//TraditionalForm
Out[]//TraditionalForm=
0.0223172139798520103824263061096657053816142787336076491498565735075784938534542633269142347429034257334133198806005769957272081553579779121349985105267
Find the probability of getting between 144 and 156 tails before getting 150 heads.
In[]:=
Probability[144<=x<=156,x]//TraditionalForm
Out[]//TraditionalForm=
297857618329631577142510926472452399321226408704586048733051249882573754121758523794407601/1018517988167243043134222844204689080525734196832968125318070224677190649881668353091698688
In[]:=
NProbability[144<=x<=156,x,WorkingPrecision->150]//TraditionalForm
Out[]//TraditionalForm=
0.292442177546227742645308199294917938042209286047821489985938298898894428661664174648671978500538827238572356679570434698803903729994502214511203952152

Dice

Investigate the behavior of probabilities until a 6 is rolled 60 times.
In[]:=
=NegativeBinomialDistribution60,
1
6

Out[]=
NegativeBinomialDistribution60,
1
6

In[]:=
DiscretePlot[PDF[,k],{k,140,470},ImageSize->Full]
Find the average number of rolls needed:
Find the probability of needing between 200 rolls and 400 rolls:
Find the conditional probability of needing 300 rolls given between 200 rolls and 400 rolls are needed:

Hypergeometric Distribution Examples

larger example of Wallenius Hypergeometric

Bob wants to catch 403 fish.
The lake contains 570 red fish with a weight of 3 N and 144 blue fish with a weight of 14 N.
Find the probability at least 260 red fish were caught.
Find the probability between 263 and 270 red fish were caught:
Find the probability between 264 and 268 red fish were caught given between 263 and 270 fish were caught:
Form an approximate exact solution:
Find a more accurate exact solution:
Find the difference:
Please comment if you have any ideas on how to find the exact conditional probability for Wallenius noncentral hypergeometric distribution.
Find the average number of red fish caught:
Find the variance:
Simulate 30 catches of fish:
The cases above could also be interpreted as marbles in an urn, for example.
Find the second moment:
I think more research is needed on the Wallenius noncentral hypergeometric distribution.

Simple Fisher hypergeometric

You are catching fish as in the example with Bob, but using a big net. You set up the net one day and come back the next day to remove the net. You count how many fish you have caught and then you go home regardless of how many fish you have caught. Each fish has a probability of being ensnared that is proportional to its weight but independent of what happens to the other fish.
​
The total number of fish that will be caught in this scenario is not known in advance. The expected number of fish caught is therefore described by multiple binomial distributions, one for each kind of fish.
​
After the fish have been counted, the total number n of fish is known. The probability distribution when n is known (but the number of each type is not known yet) is Fisher’s noncentral hypergeometric distribution.
Find the probability at least 3 red fish were caught.
Find the average number of red fish caught:
Simulate the number of red fish in 30 consecutive samples of 12:
Compute the variance:
Compute a conditional probability
Do another simulation of 30 consecutive samples of 12:

Multivariate hypergeometric

An urn contains 12 red glass marbles, 23 blue glass marbles, 11 yellow glass marbles and 9 green glass marbles. Find the distribution of a sample of 28 marbles drawn without replacement:
Find the probability of observing between 5 and 8 red marbles, 3 and 10 blue marbles, 4 and 7 yellow marbles, and 4 and 7 green marbles in an urn with 12 red, 23 blue, 11 yellow, and 9 green with a sample size of 28:
Find the probability of observing between 6 and 8 red marbles given that there between 5 and 10 red marbles are observed, 3 and 10 blue marbles, 4 and 7 yellow marbles, and 4 and 7 green marbles in an urn with 12 red, 23 blue, 11 yellow, and 9 green with a sample size of 28:
Find the covariance matrix of the distribution: