If you perform an experiment n times, where the probability of success each time is p, then the probability of exactly k successes is
binomial(n,k,p) = | ⎛ ⎝ |
| ⎞ ⎠ | pk (1−p)n−k |
This determines the binomial distribution, and so this is called the binomial command. If you enter
you will get
If no third argument p is given, then binomial will just compute (kn), which recall is called the binomial coefficient and is also computed by comb. If you enter
or
then you will get
Recall that the cumulative distribution function (cdf) for a distribution is cdf(x) = Prob(X ≤ x). For the binomial distribution, this is given by the binomial_cdf command; binomial_cdf(n,p,x), which in this case will equal binomial(n,0,p) + …+ binomial(n,floor(x,p). If you enter
you will get
You can give binomial_cdf an additional argument; binomial_cdf(n,p,x,y) = Prob(x ≤ X ≤ y), which in this case would be binomial(n,ceil(x),p) + ⋯ + binomial(n,floor(y),p). If you enter
you will get
Given a value h, the inverse distribution function gives the value of x so that Prob(X ≤ x) = h; or for discrete distributions, the smallest x so that Prob(X ≤ x) ≥ h. For the binomial distribution with n and p, the binomial_icdf gives the inverse distribution function. If you enter
you will get
Note that binomial_cdf(4,0.5,3) is 0.9375, bigger than 0.9, while binomial_cdf(4,0.5,2) is 0.6875, smaller than 0.9.