Interview's MateData Science
Interview's Mate

Data Science

Python → ML → MLOps

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Data Science topics
Lesson 46/ 160
03. Mathematics & Statistics

Discrete Distributions (Binomial, Poisson)

Model counts and success/failure trials with binomial and Poisson distributions.

IntermediateBinomial · Poisson3 quiz questions
Practice Generative AI Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

The binomial counts how many successes you get out of a fixed number of tries; the Poisson counts how many events happen in a stretch of time.

Think of it like…

Binomial: flipping a biased coin 20 times and counting heads. Poisson: standing by a road and counting cars that pass in a minute: no fixed number of "trials", just events arriving at some average rate.

Where you’ve seen it

A campaign emails 20 users, each with a 10% chance of converting. Conversions follow Binomial(n = 20, p = 0.1): mean 2, variance 1.8. P(0) = 0.9²⁰ ≈ 0.122, P(1) ≈ 0.270, P(2) ≈ 0.285, so P(at most 2) ≈ 0.677 and P(3 or more) ≈ 0.323. Separately, a support desk gets 4 tickets per hour on average: Poisson(λ = 4) gives P(0) = e⁻⁴ ≈ 0.018 and P(exactly 4) ≈ 0.195, and P(at most 2) ≈ 0.238, which helps size staffing.

Words you’ll hear

PMF
Probability mass function: P(X = k) for each possible count k.
Binomial(n, p)
Number of successes in n independent trials with success probability p.
Poisson(λ)
Number of independent events in an interval when the average rate is λ.
Overdispersion
Variance larger than the Poisson's mean, signalling clustering or varying rates.

Visual diagram

Loading interactive diagram

Theory & deep dive

The binomial distribution

Conditions: a fixed number n of trials, each with only two outcomes, the same success probability p, and independence between trials. The PMF is P(X = k) = C(n, k) pᵏ (1 − p)ⁿ⁻ᵏ, with mean np and variance np(1 − p). For n = 20 and p = 0.1: P(0) = 0.9²⁰ = 0.122; P(1) = 20 × 0.1 × 0.9¹⁹ = 0.270; P(2) = 190 × 0.01 × 0.9¹⁸ = 0.285. So there's a 32% chance of three or more conversions even though the expectation is 2.

Binomial calculations are the basis of tests on proportions and A/B tests: if the true rate is 10%, the number of conversions in 1,000 visitors has mean 100 and std √(1000 × 0.1 × 0.9) ≈ 9.5, so observing 125 is more than 2.5 standard deviations away. Violations of the assumptions matter: if users share a household or session, outcomes are correlated and the real variance is larger than the binomial's. In Python use scipy.stats.binom(n, p) with .pmf, .cdf, .sf (survival, P(X > k)) and .rvs for simulation.

A tail probability

1 - binom.cdf(2, 20, 0.1) = P(X ≥ 3) ≈ 0.323, and binom.sf(2, 20, 0.1) gives the same, more accurate for tiny tails.

Key takeaway: Binomial: fixed n, two outcomes, constant p, independent trials.

The Poisson distribution and checking assumptions

Poisson models counts of independent events at a constant average rate λ per interval: P(X = k) = e^(−λ) × λ^k / k!. With λ = 4 per hour: P(0) ≈ 0.018, P(1) ≈ 0.073, P(2) ≈ 0.147, P(3) ≈ 0.195, P(4) ≈ 0.195. Scaling is natural: if the rate is 4 per hour, the count in 30 minutes is Poisson(2). When n is large and p small, Binomial(n, p) ≈ Poisson(np): with n = 1,000 and p = 0.003, P(0) is 0.0495 (binomial) versus 0.0498 (Poisson, λ = 3).

Real counts often violate the assumptions: events cluster (a viral post), rates vary by hour or user, or there are more zeros than expected. A quick diagnostic is variance ÷ mean: near 1 supports Poisson, well above 1 indicates overdispersion, handled with the negative binomial distribution or by modelling the rate with covariates (Poisson or negative binomial regression, statsmodels.GLM). Always define the interval and exposure (per hour, per 1,000 users) so rates are comparable, and plot observed counts against the fitted PMF.

Overdispersion check

Hourly ticket counts have mean 4.1 and variance 9.8. The ratio 2.4 is far above 1, so a plain Poisson model will understate uncertainty; a negative binomial model or hour-of-day covariates fit better.

Key takeaway: Poisson: independent events at a constant rate; test variance ≈ mean and watch for overdispersion.

How it works, step by step

Step 1 of 4
Frame

1. Identify what is counted

Decide whether there's a fixed number of trials (binomial) or events over an interval (Poisson).

20 emails vs tickets per hour
Key numbers at this step
Define
the interval or n

When to use it & trade-offs

What it is

A discrete distribution gives the probability of each possible whole-number outcome, through a probability mass function (PMF). The binomial distribution counts successes in n independent trials that each succeed with probability p: mean np, variance np(1 − p). The Poisson distribution counts events in a fixed interval of time or space when events occur independently at an average rate λ: mean = variance = λ. They model conversions out of visitors, defects in a batch, tickets per hour, or arrivals per minute, and they underpin tests on proportions and counts.

Why it matters: Counts are everywhere in data science and are not normally distributed when small: you can't have −2 clicks, and with a conversion rate of 3% the distribution of conversions in 100 visits is visibly skewed. Choosing the right count distribution gives correct probabilities, p-values and confidence intervals, and leads naturally to logistic regression (binomial) and Poisson regression. Checking the mean = variance property of the Poisson also reveals overdispersion in real data.

When to reach for it

  • Conversion counts and proportion tests
  • Arrival, ticket and defect counts
  • Setting alert thresholds and capacity

When to avoid or be careful

  • Treating correlated trials as independent
  • Using Poisson for clustered, overdispersed counts
  • Mixing intervals of different lengths without scaling λ

Count distributions

Binomial
Best for: Successes out of a fixed number of trials

Strengths: Exact for independent yes/no trials; basis of proportion tests.

Watch out: Needs fixed n and constant p.

Poisson
Best for: Event counts per interval

Strengths: One parameter; simple rate scaling.

Watch out: Variance fixed equal to the mean.

Negative binomial
Best for: Overdispersed counts

Strengths: Extra parameter for variance above the mean.

Watch out: More complex to fit and explain.

Interview signals & numbers to know

When this topic comes up

  • “Probability of at least 3 conversions”
  • “How many tickets per hour should we plan for?”
  • “Binomial vs Poisson”
  • Overdispersion in count data
  • Poisson regression

Benchmarks & rules of thumb

0.677 / 0.323 -
P(X ≤ 2) and P(X ≥ 3) for Binomial(20, 0.1)
0.195 -
P(X = 4) for Poisson(4)
λ -
equals both mean and variance of a Poisson

Common mistakes & follow-ups

Common interview mistakes

  • Using a normal approximation for a binomial with np = 2, where the distribution is clearly skewed.
  • Applying Poisson to events that arrive in bursts without checking variance.
  • Quoting a rate per hour and applying it to a 30-minute window without halving λ.

Likely interviewer follow-ups

  • What are the assumptions of the binomial distribution?
  • When can a binomial be approximated by a Poisson?
  • How do you detect overdispersion?
Interview tip: Compute one probability by hand (P(0) = 0.9²⁰) to show you understand the PMF, then switch to scipy for the rest.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Discrete Distributions (Binomial, Poisson) with data science interview Q&A and hands-on practice.

Open Data Science Q&A →Machine Learning Q&A
Previous topic
Bayes Theorem
Next topic
Continuous Distributions (Normal, Exponential, Uniform)