2026-03-07

What is binomial distribution

  • Binomial distribution is a probability distribution that allows you to calculate the distribution of a two-outcome event for a certain number of trials of that experiment.
  • Some examples of two outcome events are:
    • Coin flips
    • True or false exam questions
  • It useful for predicting the likelihood of the number of successes/failures in an experiment.
  • It is very important in things like medical trials to survey the safety of a new drug.

Probability Mass Function Equation

  • This equation is used to calculate the probability of getting exactly k successes in n trials.
  • \(P(X = k) = \binom{n}{k}p^{k}(1-p)^{n-k}\)
    • \(\binom{n}{k} = \frac{n!}{(n-k)!k!}\)
    • Number of trials \(\to n\)
    • Number of successful trials \(\to k\)
    • Probability of successful event \(\to p\)

Plot of the Probability Mass Function of 50 Coin Flips

Plot of the probability mass function of 50 Trials on an Event With a 70% Success Rate

Cumulative distribution function, mean, and standard deviation

  • Cumulative Distribution Function
    • This equation is used to calculate the probability of getting at most k successes in n trials.
    • \(P(X \leq k) = \sum_{i=0}^{k}\binom{n}{i}p^{i}(1-p)^{n-i}\)
  • Mean
    • This is used to calculate the expect value in n trials.
    • \(\mu = np\)
  • Standard Deviation
    • \(\sigma = \sqrt{(np(1-p))}\)

Plot of the Mean and Standard Deviation for Coin Flips

Code for Plotting the Mean and Standard Deviation for Coin Flips

p = 0.5
n = 1000
mean1 = 1:n
stddev1 = 1:n
for (i in 1:length(mean1)) {mean1[i] = i*p}
for (i in 1:length(stddev1)) {stddev1[i] = sqrt(i*p*(1-p))}
df = data.frame(
  1:n,
  mean1,
  stddev1
)
fig <- plot_ly(df, x=mean1, name='Mean', type = 'scatter', mode='lines')%>%
  add_trace(y=stddev1,name='Std Dev', mode='lines')

Works Cited