1. Introduction

In the study of discrete probability distributions, the Binomial Distribution is the most widely used model for counting successes. It describes the behavior of a random variable that represents the number of “successes” in a sequence of independent experiments.

2. The Bernoulli Process

A Binomial experiment consists of repeated Bernoulli trials. A Bernoulli trial is a random experiment with exactly two possible outcomes: “Success” (S) and “Failure” (F).

The BINS Criteria

For a random variable \(X\) to follow a Binomial distribution, it must satisfy these four conditions:

  1. Binary: There are only two possible outcomes (e.g., Yes/No, Head/Tail).
  2. Independent: The result of one trial does not affect the next.
  3. Number: The number of trials (\(n\)) is fixed in advance.
  4. Success: The probability of success (\(p\)) remains constant for every trial.

3. Mathematical Formulation

If a random variable \(X\) follows a Binomial distribution with \(n\) trials and probability \(p\), we denote it as: \[X \sim B(n, p)\]

3.1 Probability Mass Function (PMF)

The probability of achieving exactly \(k\) successes is:

\[P(X = k) = \binom{n}{k} p^k (1-p)^{n-k}\]

Where: * \(n\): Total number of trials. * \(k\): Number of successes (\(0, 1, \dots, n\)). * \(p\): Probability of success. * \(\binom{n}{k} = \frac{n!}{k!(n-k)!}\) (The Binomial Coefficient).

3.2 Mean and Variance

  • Expected Value (Mean): \(\mu = np\)
  • Variance: \(\sigma^2 = np(1-p)\)
  • Standard Deviation: \(\sigma = \sqrt{np(1-p)}\)

4. Visualizing the Distribution

The shape of the distribution changes based on the probability \(p\).


5. Real-Life Examples

Example 1: Quality Control

A factory produces components with a 5% defect rate (\(p=0.05\)). In a random batch of 10 components, what is the probability that exactly 2 are defective?

Solution: \(n=10, k=2, p=0.05\)

dbinom(x = 2, size = 10, prob = 0.05)
## [1] 0.0746348

Example 2: Customer Conversion

An online store has a 10% conversion rate. If 50 people visit the site, what is the probability that more than 8 people make a purchase?

Solution: We need \(P(X > 8)\), which is \(1 - P(X \le 8)\).

1 - pbinom(8, size = 50, prob = 0.10)
## [1] 0.05786721

6. Essential R Functions


7. Chapter Exercises

Exercise 1: The Guessing Student

A student takes a 10-question multiple-choice quiz. Each question has 5 options, and only one is correct. The student guesses randomly on every question. 1. What is the probability of getting exactly 4 correct? 2. What is the probability of passing (getting 6 or more correct)?

Exercise 2: IT Support

A server has a 99% uptime probability on any given day. Over a 30-day month: 1. What is the expected number of days the server is up? 2. What is the probability that the server stays up for all 30 days?

Exercise 3: Simulation

Run the following code to simulate 1,000 trials of flipping a fair coin 10 times.

set.seed(123)
sim_data <- rbinom(1000, size = 10, prob = 0.5)
hist(sim_data, breaks = 10, main = "Simulation of 1000 Coin Flip Sets", 
     xlab = "Number of Heads", col = "lightgreen")


8. Summary Table

Feature Formula / Value
Parameters \(n\) (trials), \(p\) (prob of success)
Support \(k \in \{0, 1, \dots, n\}\)
Mean \(np\)
Variance \(np(1-p)\)
R Function (Exact) dbinom()
R Function (Cumulative) pbinom()

### How to fix your R environment (Optional)
If you still want to use `ggplot2` in the future, you should fix the `ffi_list2` error by running this in your R console:

```r
install.packages("rlang", type = "binary")
install.packages("ggplot2", type = "binary")

Then restart RStudio before knitting again. However, the Base R version I provided above will work immediately without needing these fixes.