Skip to content
Kordu Tools

Probability Explained: From Coin Flips to Bayes' Theorem

Learn probability from basics to Bayes' theorem with real examples. Covers addition and multiplication rules, expected value, and the birthday problem.

I
iyda
14 min read
probability probability explained bayes theorem probability formulas conditional probability

Probability runs everything from weather forecasts to medical diagnoses, yet most people’s understanding stops at coin flips. According to a National Center for Education Statistics report (2024), only 26% of U.S. twelfth-graders scored “proficient” or above in mathematics, and probability consistently ranks among the weakest subtopics.

This guide builds your understanding step by step. We start with a single coin toss and work up to Bayes’ theorem, the formula behind spam filters, medical testing, and courtroom evidence. Every concept gets a real-world example, not just abstract notation.

math tools collection

Key Takeaways

  • Basic probability is favorable outcomes divided by total outcomes. A fair die has a 1/6 chance per face.
  • The multiplication rule calculates AND probabilities: two heads in a row is 0.5 x 0.5 = 0.25.
  • Bayes' theorem updates probability with new evidence, used in 85% of modern spam filters (Google AI Blog, 2023).
  • Expected value reveals the long-run average of a random process, essential for evaluating bets and business decisions.
  • The birthday problem shows that just 23 people give a 50% chance of a shared birthday, an unintuitive result.

Try Probability Calculations

Plug in your own numbers below. Experiment with different event counts and sample spaces to build intuition before we walk through the theory.

Try it Probability Calculator

Favorable outcomes must be a non-negative integer less than or equal to total outcomes (total must be > 0).

Result

Enter values above to calculate the probability.

Formulae

P(A) = favorable outcomes / total outcomes

P(A AND B) = P(A) × P(B)   (independent)

P(A OR B) = P(A) + P(B) − P(A AND B)

P(A|B) = P(A∩B) / P(B)

Bayes: P(A|B) = P(B|A) × P(A) / P(B)

What Is Probability and Why Does It Matter?

Probability measures how likely an event is to occur, expressed as a number between 0 (impossible) and 1 (certain). The Khan Academy probability curriculum (2025) reports over 18 million learners annually, making it one of the most studied math topics online.

The basic formula is straightforward:

P(event) = favorable outcomes / total possible outcomes

Flip a fair coin. Two possible outcomes, one favorable. P(heads) = 1/2 = 0.5 = 50%. Roll a standard die. Six outcomes, one favorable per face. P(rolling a 4) = 1/6 = 16.7%.

These aren’t just classroom exercises. Insurance companies price every policy using probability. Doctors weigh treatment options with it. Poker players who understand probability win more often than those playing on instinct.

percentage calculations

Probability Scale Quick Reference

Probability Meaning Example
0 Impossible Rolling a 7 on a standard die
0.01 (1%) Very unlikely Drawing a specific card twice in a row
0.25 (25%) Unlikely Drawing a heart from a full deck
0.50 (50%) Even odds Fair coin landing heads
0.75 (75%) Likely Drawing a non-heart from a full deck
1.0 (100%) Certain Rolling 1-6 on a standard die

Citation capsule: Probability quantifies uncertainty on a 0-to-1 scale, where P(event) equals favorable outcomes divided by total outcomes. Over 18 million learners study probability annually through Khan Academy alone (Khan Academy, 2025), reflecting its foundational role across science, finance, and daily decision-making.

How Does the Addition Rule Work?

The addition rule calculates “or” probabilities, the chance of one event or another occurring. According to the American Statistical Association (2024), misapplying the addition rule is the single most common error in introductory probability courses.

For mutually exclusive events (events that can’t happen simultaneously):

P(A or B) = P(A) + P(B)

What’s the probability of drawing a king or a queen from a standard 52-card deck? Kings and queens are mutually exclusive: a card can’t be both. P(king or queen) = 4/52 + 4/52 = 8/52 = 15.4%.

When Events Overlap

For events that can happen together, you must subtract the overlap:

P(A or B) = P(A) + P(B) - P(A and B)

What’s the probability of drawing a king or a heart? There are 4 kings and 13 hearts, but one card (king of hearts) is both. P(king or heart) = 4/52 + 13/52 - 1/52 = 16/52 = 30.8%.

Forgetting to subtract that overlap is exactly the mistake the ASA flagged. If you just added 4/52 + 13/52, you’d count the king of hearts twice.

probability calculator Citation capsule: The addition rule for non-mutually-exclusive events is P(A or B) = P(A) + P(B) - P(A and B). The American Statistical Association (ASA, 2024) identifies forgetting to subtract the overlapping probability as the most common introductory error in probability coursework.

What Is the Multiplication Rule?

The multiplication rule handles “and” probabilities, the chance of multiple events all happening. Research published in the Journal of Statistics Education (2023) found that students who practiced the multiplication rule with real scenarios scored 34% higher on conditional probability questions later.

For independent events (one event doesn’t affect the other):

P(A and B) = P(A) x P(B)

Flip two coins. P(both heads) = 0.5 x 0.5 = 0.25. Roll two dice. P(both sixes) = 1/6 x 1/6 = 1/36 = 2.8%.

For dependent events (one event changes the probability of the next):

P(A and B) = P(A) x P(B|A)

Draw two cards without replacement. P(first is ace) = 4/52. P(second is ace, given first was ace) = 3/51. P(both aces) = 4/52 x 3/51 = 12/2652 = 0.45%.

Quick mental check

If your “and” probability is larger than either individual probability, something’s wrong. The chance of two things both happening can never exceed the chance of either one alone.

Citation capsule: The multiplication rule states that P(A and B) = P(A) x P(B) for independent events. Students who practice this rule with applied scenarios score 34% higher on later conditional probability assessments, according to research in the Journal of Statistics Education (Taylor & Francis, 2023).

How Do Independent and Dependent Events Differ?

Independent events don’t influence each other. A MIT OpenCourseWare probability lecture (2024) notes that confusing independence with dependence accounts for roughly 40% of errors in undergraduate probability exams. Here’s the critical distinction:

Feature Independent Events Dependent Events
Definition Outcome of one doesn't affect the other Outcome of one changes the other's probability
Formula P(A and B) = P(A) x P(B) P(A and B) = P(A) x P(B|A)
Example Flipping a coin twice Drawing cards without replacement
Real-world Weather in London vs. Tokyo Pulling parts from a shrinking inventory
Key test Does knowing A happened change P(B)? Does knowing A happened change P(B)?
If no, they are... Independent
If yes, they are... Dependent

A common trap: people treat dependent events as independent. If a factory produces 5% defective items and you test two items from a small batch, the second test depends on the first result. Only when the batch is very large (or you replace items) can you treat them as approximately independent.

Why does this matter outside a classroom? Card counters in blackjack exploit dependence. Each card dealt changes the probability of what comes next. That’s the entire basis of counting systems.

random number generation

What Is Conditional Probability?

Conditional probability measures the likelihood of an event given that another event has already occurred. The notation P(B|A) reads “probability of B given A.” A Harvard Statistics Department study (2023) found that conditional probability is the concept students find hardest in introductory stats, with only 38% answering related exam questions correctly on the first attempt.

P(B|A) = P(A and B) / P(A)

Here’s a concrete example. In a class of 100 students, 40 study math, 30 study physics, and 10 study both. What’s the probability a student studies physics, given they study math?

P(physics | math) = P(math and physics) / P(math) = (10/100) / (40/100) = 10/40 = 25%.

Knowing someone studies math narrows the pool from 100 to 40 students, and 10 of those 40 also study physics. Conditional probability is the gateway to Bayes’ theorem. If you understand the formula above, you’re already halfway to understanding the most powerful idea in modern probability.

Citation capsule: Conditional probability, P(B|A) = P(A and B) / P(A), measures event likelihood given prior knowledge. Harvard’s statistics department (Harvard Statistics, 2023) reports only 38% of introductory students answer conditional probability questions correctly on their first attempt, making it the most challenging foundational concept.

How Do Permutations and Combinations Differ?

Permutations count arrangements where order matters. Combinations count selections where it doesn’t. According to the College Board AP Statistics curriculum (2025), permutation and combination problems appear in 12-15% of exam questions annually.

The formulas:

Permutations: P(n, r) = n! / (n - r)!
Combinations: C(n, r) = n! / (r! x (n - r)!)
Scenario Type Formula Result
Arrange 3 books on a shelf from 10 Permutation P(10, 3) = 10! / 7! 720
Choose 3 books to take on vacation from 10 Combination C(10, 3) = 10! / (3! x 7!) 120
4-digit PIN (digits can repeat) Permutation with repetition 10^4 10,000
Pick 5 lottery numbers from 49 Combination C(49, 5) 1,906,884
Rank top 3 from 8 contestants Permutation P(8, 3) = 8! / 5! 336
Select a 5-person committee from 12 Combination C(12, 5) 792

The quick decision rule: Does rearranging your selection create a different outcome? If picking Alice-Bob-Carol is different from Carol-Bob-Alice, use permutations. If those are the same committee, use combinations.

permutation and combination calculator

Lottery odds in perspective

The odds of winning the UK National Lottery (matching 6 from 59) are 1 in 45,057,474. You’re roughly 23 times more likely to be struck by lightning in your lifetime, based on National Weather Service estimates.

What Is Expected Value?

Expected value is the long-run average outcome of a random process, calculated by multiplying each outcome by its probability and summing the results. The National Council of Teachers of Mathematics (NCTM, 2024) recommends teaching expected value before students encounter any real-world gambling or investment scenarios.

E(X) = sum of [each outcome x its probability]

A Simple Dice Example

Roll a fair die. Each face (1 through 6) has probability 1/6.

E(X) = (1 x 1/6) + (2 x 1/6) + (3 x 1/6) + (4 x 1/6) + (5 x 1/6) + (6 x 1/6) = 3.5

You’ll never roll a 3.5, but over thousands of rolls, your average will converge to exactly that.

Why Casinos Always Win

Consider a simplified roulette bet. You bet $1 on a single number. If you win (probability 1/38 on an American wheel), you get $35 plus your $1 back. If you lose (37/38), you lose your $1.

E(bet) = (35 x 1/38) + (-1 x 37/38) = 0.921 - 0.974 = -$0.053

Every dollar bet has an expected loss of 5.3 cents. The casino doesn’t need to win every spin. It just needs the math to hold over millions of spins. And it always does. That -5.3 cents per dollar is why casinos don’t care about individual winners. The expected value is baked into the game design. The same logic applies to insurance pricing, startup investment, and any repeated decision under uncertainty.

Citation capsule: Expected value, E(X), equals the sum of each outcome multiplied by its probability, representing the long-run average of a random process. The NCTM (National Council of Teachers of Mathematics, 2024) recommends teaching expected value before any exposure to gambling or investment decision-making.

How Does Bayes’ Theorem Work?

Bayes’ theorem updates a probability estimate when new evidence arrives. Named after Reverend Thomas Bayes (1763), it’s now central to machine learning, medical diagnostics, and spam filtering. Google’s AI research team noted in a Google AI Blog post (2023) that Bayesian inference underpins roughly 85% of production spam classification systems.

The formula:

P(A|B) = [P(B|A) x P(A)] / P(B)

Where:

  • P(A|B) = probability of A given B (what you want)
  • P(B|A) = probability of B given A (test sensitivity)
  • P(A) = prior probability of A (base rate)
  • P(B) = total probability of B

The Medical Test Example

This is the classic example, and it’s worth working through carefully because the result surprises almost everyone.

A disease affects 1 in 1,000 people. A test for it is 99% accurate: it correctly identifies 99% of sick people (sensitivity) and correctly clears 99% of healthy people (specificity). You test positive. What’s the probability you actually have the disease?

Most people guess around 99%. The real answer is about 9%.

Here’s why:

  • P(disease) = 0.001
  • P(positive | disease) = 0.99
  • P(positive | no disease) = 0.01
  • P(no disease) = 0.999
P(positive) = P(pos|disease) x P(disease) + P(pos|no disease) x P(no disease)
P(positive) = (0.99 x 0.001) + (0.01 x 0.999) = 0.00099 + 0.00999 = 0.01098
P(disease|positive) = (0.99 x 0.001) / 0.01098 = 0.0902 = ~9%

A 99% accurate test, and a positive result still means only a 9% chance of disease. The low base rate (1 in 1,000) means false positives vastly outnumber true positives. Out of 1,000 people tested, roughly 1 sick person tests positive, and about 10 healthy people also test positive.

Base rate neglect

Ignoring the base rate is called “base rate neglect,” and it affects doctors too. A study in the New England Journal of Medicine (Casscells et al.) found that only 18% of physicians at Harvard Medical School correctly answered a version of this problem.

This is why mass screening programs for rare diseases can generate more anxiety than useful diagnoses. Understanding Bayes’ theorem changes how you interpret any test result, medical, security, or otherwise.

statistics calculations

Citation capsule: Bayes’ theorem, P(A|B) = P(B|A) x P(A) / P(B), updates probability estimates with new evidence. In the classic medical screening scenario, a 99% accurate test yields only a 9% true-positive rate for a disease affecting 1 in 1,000 people, because false positives overwhelm true positives when the base rate is low.

What Is the Birthday Problem?

The birthday problem asks how many people you need in a room before there’s a 50% chance that two share a birthday. The answer, just 23 people, shocks most first-time learners. This result has been verified computationally millions of times and is a standard example in MIT OpenCourseWare probability courses (2024).

The math works by calculating the probability that nobody shares a birthday, then subtracting from 1.

For 23 people:

  • Person 1 can have any birthday: 365/365
  • Person 2 must differ from person 1: 364/365
  • Person 3 must differ from both: 363/365
  • Continue through person 23: 343/365

Multiply all those fractions: P(no match) = 365/365 x 364/365 x 363/365 x … x 343/365 = 0.4927

P(at least one match) = 1 - 0.4927 = 0.5073, just over 50%.

With 50 people, the probability jumps to 97%. With 70 people, it’s 99.9%. Our brains expect a much larger number because we instinctively compare each person to ourselves (1/365 per person), not to every other person in the room. The birthday problem isn’t just a party trick. It’s the mathematical foundation of collision attacks in cryptography. The reason SHA-256 uses 256-bit hashes instead of, say, 64-bit hashes is directly tied to birthday problem math. A 64-bit hash would be vulnerable to collisions with only about 2^32 (roughly 4 billion) attempts, which modern hardware handles in seconds.

What Is the Gambler’s Fallacy?

The gambler’s fallacy is the false belief that past random events affect future ones. A landmark study published in the Quarterly Journal of Economics (Croson and Sundali, 2005) analyzed 18 hours of roulette play and found that players increased bets by an average of 65% after a streak of five same-color outcomes, expecting a reversal that probability doesn’t support.

Here’s the reality: a fair coin doesn’t “know” it just landed heads five times. P(heads on flip 6) is still exactly 0.5. Each flip is independent. The coin has no memory.

Where people go wrong is confusing two different questions:

  1. “What’s the probability of 6 heads in a row?” = 0.5^6 = 1.56%. This is low.
  2. “Given 5 heads already, what’s the probability the next flip is heads?” = 0.5. This is unchanged.

Question 1 is about a sequence before it starts. Question 2 is conditional on what already happened. The five heads are in the past. They don’t pull the next flip toward tails.

The hot hand is real (sometimes)

Don’t confuse the gambler’s fallacy with the “hot hand” in basketball. Research in Econometrica (Miller and Sanjurjo, 2018) showed that basketball shooting streaks are statistically real, not a fallacy. The difference: basketball shots involve skill, not pure randomness. A coin toss involves no skill at all.

Citation capsule: The gambler’s fallacy is the mistaken belief that past independent random outcomes influence future results. A study in the Quarterly Journal of Economics (Croson and Sundali, 2005) found roulette players increased bets by 65% after five same-color outcomes, expecting a reversal that pure probability does not predict.

Probability Formulas Quick Reference

Rule Formula Use When
Basic probability P(A) = favorable / total Single event, equally likely outcomes
Addition (exclusive) P(A or B) = P(A) + P(B) Events that cannot overlap
Addition (general) P(A or B) = P(A) + P(B) - P(A and B) Events that can overlap
Multiplication (independent) P(A and B) = P(A) x P(B) Events that don't affect each other
Multiplication (dependent) P(A and B) = P(A) x P(B|A) Events where one affects the next
Conditional P(B|A) = P(A and B) / P(A) Probability of B given A occurred
Bayes' theorem P(A|B) = P(B|A) x P(A) / P(B) Updating probability with new evidence
Expected value E(X) = sum(x_i x P(x_i)) Long-run average of a random process
Permutations P(n,r) = n! / (n-r)! Ordered arrangements
Combinations C(n,r) = n! / (r!(n-r)!) Unordered selections

Frequently Asked Questions

What is the easiest way to understand probability?

Start with physical objects you can visualize. A single die has 6 faces, giving each outcome a 1/6 probability. A deck of 52 cards makes fractions concrete: 4 aces out of 52 cards means P(ace) = 4/52 = 7.7%. According to Khan Academy research (2025), learners who practice with tangible examples before moving to formulas retain concepts 45% longer.

How is Bayes’ theorem used in real life?

Bayes’ theorem powers spam filters, medical diagnostic algorithms, recommendation engines, and weather forecasting models. About 85% of production spam classifiers use Bayesian inference (Google AI Blog, 2023). Courts in the UK have even used Bayesian reasoning to weigh forensic DNA evidence. Anytime you need to update a probability based on new information, Bayes’ theorem applies.

What is the difference between permutations and combinations?

Permutations care about order. Combinations don’t. Arranging 3 books on a shelf from 10 options yields 720 permutations because each ordering is distinct. Choosing 3 books to pack (regardless of order) yields 120 combinations. According to College Board data (2025), this distinction appears in 12-15% of AP Statistics exam questions each year.

Why do people fall for the gambler’s fallacy?

Humans are wired to find patterns, even in randomness. Cognitive psychologists call this “apophenia.” The brain treats a streak of coin-flip heads as meaningful and predicts tails must follow. Research in the Quarterly Journal of Economics (2005) showed gamblers bet 65% more after streaks, despite each spin being statistically independent of the last.

How does the birthday problem apply to cybersecurity?

The birthday problem’s math governs collision attacks on hash functions. A 128-bit hash isn’t secure against collision-finding because an attacker only needs about 2^64 attempts, not 2^128, to find two inputs with the same hash. This is why modern cryptographic standards like SHA-256 use longer output lengths, to push the birthday-attack threshold beyond practical computation, as outlined in NIST SP 800-107 (NIST, 2012).

Wrapping Up

Probability starts with a simple fraction: favorable outcomes over total outcomes. From that single idea, you get addition rules for “or” questions, multiplication rules for “and” questions, and conditional probability for “given that” questions. Bayes’ theorem ties it all together by showing how evidence updates belief.

The concepts here aren’t just academic. They shape medical decisions, power search engines, secure your passwords, and explain why the lottery is a bad investment. The birthday problem and the gambler’s fallacy reveal how poorly human intuition handles randomness, which is exactly why learning the math matters.

Practice with real numbers. Use the probability calculator above. Work through the medical test example with different base rates. The best way to build probability intuition is to compute, check, and repeat.

explore all math tools