Probability Calculator: And, Or, At Least Once & Bayes
If something has a 20% chance each time, do five tries make it certain? Five times 20% is 100%, so it is tempting to say yes. The real answer is 67.23%. One time in three, all five tries miss. Chances don’t add up across tries. You multiply the misses instead: 0.8 × 0.8 × 0.8 × 0.8 × 0.8 = 0.32768, and 1 − 0.32768 = 0.67232.
This calculator handles that kind of question and three others: a single event from counts, two events combined with “and” or “or”, repeated tries, and what a positive test result really means. Answers come as exact fractions when you type fractions, with decimals, percents and every step.
For a die, rolling a 5 or a 6 is 2 favorable outcomes out of 6. The outcomes must be equally likely.
Type probabilities as fractions (1/6), decimals (0.25) or percents (25%). Answers stay exact as fractions where they can.
Each try must be independent with the same chance, like rolling a die or flipping a coin.
Sensitivity: share of people with the condition who test positive. Specificity: share of people without it who test negative.
Counting, Combining, Repeating or Testing: Which Tab You Need
Each tab answers a different kind of question:
| Your question sounds like… | Tab | Example |
|---|---|---|
| “What’s the chance of drawing a king?” | One event | 4 kings out of 52 cards = 1/13 |
| “What’s the chance of A or B?” / “A and B?” | Two events | A king or a heart = 4/13 |
| “What’s the chance of at least one hit in 20 tries?” | Repeated tries | 5% each time, 20 tries = 64.15% |
| “I tested positive. How likely is it that I have it?” | Test result (Bayes) | 1% common, 90% sensitive, 91% specific = 9.17% |
Probabilities can be typed three ways: as a fraction (1/6), a decimal (0.25) or a percent (25%). If you type a fraction, the answer stays a fraction where it can, such as 91/216 instead of 0.4213. That matters on homework, where a teacher may want the exact form. It also stops rounding errors from piling up. Three outcomes of 1/3 each add up to exactly 1, but rounded to 0.33 they add up to 0.99, and the missing 0.01 has nowhere to go. Keep fractions until the last step (the fraction calculator adds them for you), then round once.
One Event: Favorable Over Total
The starting rule is:
P(event) = favorable outcomes ÷ total possible outcomes
A standard deck has 52 cards and 4 kings, so the chance of drawing a king is 4/52. Both numbers divide by 4, giving 1/13, or about 7.69%. Rolling a 5 or a 6 on one die is 2 favorable outcomes out of 6, which is 1/3.
This rule only works when every outcome is equally likely. A shuffled deck and a fair die qualify. “Will it rain tomorrow: yes or no?” does not. There are two outcomes, but nobody would say the chance of rain is always 1/2.
Every probability sits between 0 and 1. A probability of 0 means the event can’t happen, 1 means it is certain, and the chance of it not happening is 1 minus the chance that it does. The calculator refuses a favorable count bigger than the total, because that would be a probability above 100%.
Theoretical vs experimental. Flip a coin 50 times and you might get 29 heads. That is an experimental probability of 29/50 = 58%, while the theoretical probability is 50%. The gap is normal. As the number of flips grows, the share of heads settles closer to 1/2. This is the law of large numbers. It doesn’t mean heads and tails take turns: any one flip is still 50–50.
Probability, Percent, Odds and “1 in N”: Four Ways to Say It
The same chance can be written four ways, and mixing them up leads to wrong answers.
| Form | Rolling double six (two dice) | Powerball jackpot |
|---|---|---|
| Fraction | 1/36 | 1/292,201,338 |
| Decimal | 0.0278 | 0.0000000034 |
| Percent | 2.78% | 0.00000034% |
| 1 in N | 1 in 36 | 1 in 292,201,338 |
| Odds (for : against) | 1 to 35 | 1 to 292,201,337 |
- Odds are not a probability. Odds compare the ways to win with the ways to lose. Probability compares the ways to win with all outcomes. Odds of 1 to 9 mean 1 win for every 9 losses, which is 1 out of 10: a probability of 10%, not 1/9 = 11.11%.
- Round honestly. 1/36 is 0.027777…, which rounds to 2.78%. Writing 2.7% cuts off a digit and rounds the wrong way.
- “1 in N” turns small decimals into something you can picture. It is just 1 divided by the probability.
The Powerball figure comes from counting. The Powerball figure comes from counting, the kind the permutation and combination calculator does. Players pick 5 white balls from 69 and 1 red ball from 26. There are 11,238,513 ways to choose the five white balls, and 26 choices of red ball, so there are 11,238,513 × 26 = 292,201,338 possible tickets. Only one of them wins the jackpot. That is the same 1 in 292,201,338 that lottery results sites list.
And, Or, Not: The Rules for Two Events
Once you have two events, A and B, three rules cover most questions:
- Not: P(not A) = 1 − P(A).
- And (both happen): P(A and B) = P(A) × P(B), but only if A and B are independent.
- Or (at least one happens): P(A or B) = P(A) + P(B) − P(A and B).
The “or” rule subtracts the overlap because adding P(A) and P(B) counts the outcomes where both happen twice.
Take one card from a deck. A = it’s a king (4/52), B = it’s a heart (13/52). The king of hearts is in both groups, so P(A and B) = 1/52. Then:
P(king or heart) = 4/52 + 13/52 − 1/52 = 16/52 = 4/13
Count it directly to check: 13 hearts plus the 3 other kings is 16 cards. Without the subtraction you’d get 17/52, counting the king of hearts twice.
The calculator also notices something here. P(king) × P(heart) = 1/13 × 1/4 = 1/52, which is exactly P(king and heart). So these two events are independent: being told a card is a heart doesn’t change the chance that it’s a king, which stays 1 in 13. Overlapping events can be independent. What matters is whether the overlap is the size the product predicts.
In the Two events tab, type P(A) and P(B), then say how they are related: independent, mutually exclusive, or “I know P(A and B)”. You get all eight answers at once: both, at least one, exactly one, neither, not A, not B, and each event given the other. A Venn diagram shows the four regions, which always add up to 100%.
Independent Is Not the Same as Mutually Exclusive
These two words sound alike, but they mean nearly opposite things.
- Independent: one event doesn’t change the chance of the other. Two separate coin flips are independent. They can both come up heads, and the chance of that is 1/2 × 1/2 = 1/4.
- Mutually exclusive: the two events can’t happen together. One die roll can’t be both a 1 and a 6. Here P(A and B) = 0, and the “or” rule shrinks to P(A or B) = P(A) + P(B).
Mutually exclusive events are never independent, unless one of them has a probability of 0. If a roll is a 6, you know for certain it isn’t a 1. Knowing one event happened changed the chance of the other from 1/6 to 0. That is the opposite of independence.
You can test independence with numbers. Events are independent exactly when P(A and B) = P(A) × P(B).
Roll one die. Let A = an even number {2, 4, 6} and B = a prime number {2, 3, 5}. Each has a probability of 1/2. If they were independent, P(A and B) would be 1/2 × 1/2 = 1/4. In fact only the 2 is both even and prime, so P(A and B) = 1/6. Since 1/6 isn’t 1/4, the events are not independent, and multiplying P(A) by P(B) gives the wrong answer. Choose “I know P(A and B)” in the calculator, type 1/2, 1/2 and 1/6, and it reports the same thing.
Conditional Probability: When Knowing One Thing Changes the Other
“The probability of A given B” is written P(A | B). It means: out of the times B happens, how often does A happen too?
P(A | B) = P(A and B) ÷ P(B)
Say you’re told a card is a face card (jack, queen or king). What’s the chance it’s a king? There are 12 face cards and 4 of them are kings, so P(king | face card) = 4/12 = 1/3. Without that information it was 1/13. The extra fact changed the probability.
The same idea explains drawing without putting cards back. The chance that the first two cards are both aces:
- First ace: 4/52.
- Second ace, given the first was an ace: 3/51, because one ace and one card are gone.
- Both: 4/52 × 3/51 = 12/2,652 = 1/221, about 0.45%.
If you put the first card back and shuffle, the second draw is independent, and the answer is 1/13 × 1/13 = 1/169. Removing the first card makes a second ace less likely. Whether items are replaced is the first thing to check in any drawing problem.
Tree Diagrams: Multiply Along the Branches, Add the Ends
When an event can happen in more than one way, a tree diagram keeps the cases apart. Each branch is one step, labeled with its chance given what came before.
A drawer holds 4 black socks and 6 white socks. You pull out two in the dark. What’s the chance they match?
- Black, then black: 4/10 × 3/9 = 12/90.
- White, then white: 6/10 × 5/9 = 30/90.
- They match (either path): 12/90 + 30/90 = 42/90 = 7/15, about 46.67%.
Two rules make every tree work. Along one path, multiply, because each step has to happen. Across different paths that lead to the same result, add, because the paths can’t both happen. The chance of a mismatch is 1 − 7/15 = 8/15. That equals the two mixed paths, black-then-white and white-then-black, each 24/90, which is a good check.
You can confirm it by counting pairs. There are C(10, 2) = 45 ways to pick two socks from ten. Of those, C(4, 2) = 6 are black pairs and C(6, 2) = 15 are white pairs, so 21 of the 45 match. Type 21 and 45 in the One event tab and it reduces the fraction to 7/15.
Three or More Independent Events
The rules stretch to any number of independent events. For “all of them”, multiply every chance. For “at least one”, multiply every chance of failure and subtract from 1.
Say a building has three separate alarms that work on a given night with chances of 90%, 80% and 70%, and they don’t depend on each other.
- All three work: 0.9 × 0.8 × 0.7 = 0.504, about half the time.
- None works: 0.1 × 0.2 × 0.3 = 0.006.
- At least one works: 1 − 0.006 = 0.994, or 99.4%.
No single alarm is close to certain. Needing all three to work (50.4%) is worse than relying on even the weakest one alone (70%), while needing just one of them is far better than any single alarm. This is why backups are built to work independently: the failure chances multiply only if one failure doesn’t cause another. Three alarms on the same power line could all fail together in a power cut, and then the 0.6% figure is far too optimistic.
The calculator’s Two events tab takes two at a time. For a third event, run it again with the first result as P(A).
At Least Once: Count the Misses
“At least once” questions are the ones the opening example got wrong. The reliable way to solve them is through the complement:
P(at least once in n tries) = 1 − P(never) = 1 − (1 − p)ⁿ
The tries must be independent, each with the same chance p.
Take a 5% chance per try, so p = 1/20:
| Tries | Chance of at least one success |
|---|---|
| 1 | 5.00% |
| 5 | 22.62% |
| 10 | 40.13% |
| 14 | 51.23% |
| 20 | 64.15% |
| 30 | 78.54% |
| 59 | 95.15% |
| 90 | 99.01% |
Twenty tries at 5% is not 100%. It’s 64.15%. You need 14 tries just to pass even odds and 59 tries to reach 95%. The Repeated tries tab works this out, and its tip says how many tries it takes to reach 50%.
Each try still starts fresh. After 19 misses in a row, the 20th try is still exactly 5%. Believing that a hit is “due” after a long run of misses is known as the gambler’s fallacy. The 64.15% describes the whole run of 20 before you start, not the next try after a losing streak.
Exactly, At Least, At Most: The Binomial Formula
When the question is “exactly r successes in n tries”, you have to count the different orders the successes can come in. The formula is:
P(exactly r) = C(n, r) × pʳ × (1 − p)ⁿ⁻ʳ
C(n, r) counts how many orders the r successes can come in. It is the same “n choose r” from combinations.
Flip a fair coin 10 times:
- Exactly 5 heads: C(10, 5) = 252 orders, each with probability (1/2)¹⁰ = 1/1,024. So P = 252/1,024 = 63/256 ≈ 24.61%. Even the most likely result happens less than a quarter of the time.
- At least 6 heads: add the cases for 6, 7, 8, 9 and 10 heads: 193/512 ≈ 37.70%.
“At least” and “at most” questions are sums of the exact cases. The calculator adds them for you. When the sum on the other side is shorter, it takes 1 minus that instead, which gives the same answer. A bar chart shows every possible count, with the counted bars in green. With many tries it takes the bell shape that the z-score calculator works with.
Pure guessing on a 10-question test with 4 choices each gives p = 1/4 per question. The chance of guessing at least 7 right is 919/262,144, about 0.35%. On average a guesser gets n × p = 2.5 right, and has a 5.63% chance of getting none at all.
Expected Value: What a Chance Is Worth on Average
A probability tells you how often. Expected value tells you how much, on average, over many repeats:
Expected value = (each outcome’s value × its probability), all added up
A school raffle sells 500 tickets at $2 each, with one $300 prize. For one ticket:
- Win: $300 with probability 1/500, worth 300 × 1/500 = $0.60.
- The ticket cost $2 either way.
- Expected value = $0.60 − $2 = −$1.40 per ticket.
That doesn’t mean you lose $1.40 on any one ticket. You either win $298 or lose $2. It means that across many raffles like this one, buyers lose $1.40 per ticket on average, which is the school’s $700 profit ($1,000 in sales minus the $300 prize) spread over 500 tickets.
The same idea gives the “expected successes” in the Repeated tries tab. Each try is worth 1 if it succeeds and 0 if it fails, so n tries are worth n × p on average. For 20 tries at 5%, that’s 1 expected success. Even so, there’s a 35.85% chance of getting none, because an average of 1 still allows plenty of runs with 0.
The Birthday Problem: Why Pairs Add Up Fast
How many people do you need in a room before two of them probably share a birthday? A guess of around 180, half of 365, sounds reasonable. The answer is 23.
The trick is the complement again. Work out the chance that all birthdays are different, then subtract from 1. The first person can have any birthday. The second must avoid one date (364/365), the third must avoid two (363/365), and so on. Ignoring February 29 and treating every date as equally likely:
| People | Chance at least two share a birthday |
|---|---|
| 20 | 41.14% |
| 23 | 50.73% |
| 30 | 70.63% |
| 50 | 97.04% |
| 70 | 99.92% |
The answer seems high if you picture your own birthday being matched. The question allows any pair to match. With 23 people there are C(23, 2) = 253 different pairs, and each pair is a fresh chance for a match.
Reading a Positive Test Result (Bayes’ Theorem)
A test that is right 90% of the time sounds like a positive result means 90% sure. It doesn’t have to, and the reason is how common the condition is.
Three numbers describe the situation:
- Base rate: how common the condition is in the people being tested. Say 1%.
- Sensitivity: the share of people with the condition who test positive. Say 90%.
- Specificity: the share of people without it who test negative. Say 91%, so 9% of healthy people get a false positive.
Picture 10,000 people:
- 100 have the condition, and 90% of them test positive: 90 true positives.
- 9,900 don’t, and 9% of them still test positive: 891 false positives.
- That makes 981 positive results in all, and only 90 of them are real.
P(condition | positive) = 90 ÷ 981 ≈ 9.17%.
That is Bayes’ theorem: P(D | +) = P(+ | D) × P(D) ÷ P(+).
The base rate drives everything. With the same test, if 10% of the people tested have the condition, a positive result is right 52.63% of the time. If someone who tested positive takes a second, independent test and that is positive too, the chance climbs from 9.17% to about 50.25%. The first result works as the new base rate. A negative result is a different story. Of the 9,019 negative results, only 10 come from people who have the condition, so a negative is right 9,009 ÷ 9,019 ≈ 99.89% of the time. With a rare condition, negatives are very reliable while positives are not. That is the reason to follow a positive screening result with a second, different test rather than treating it as a diagnosis.
Type your own numbers in the Test result tab to see the counts per 10,000 and the chance that a negative result is right.
Adding When You Should Multiply, and Four Other Slips
- Adding chances across tries. Five tries at 20% isn’t 100%, and 20 tries at 5% isn’t 100% either. Use 1 − (1 − p)ⁿ.
- Multiplying events that aren’t independent. P(A) × P(B) only works when one event doesn’t affect the other. For the even and prime die rolls it gives 1/4 instead of the true 1/6. When in doubt, count the outcomes directly.
- Forgetting the overlap in “or”. P(king or heart) is 4/13, not 17/52. Subtract the outcomes counted twice.
- Treating odds as a probability. Odds of 1 to 9 are a 10% chance. Add the two parts of the odds to get the total.
- Ignoring how rare something is. A good test can still produce more false alarms than true finds when the condition is rare. Start from the base rate, not from the test’s accuracy.
When an answer looks surprising, check it with a count. List the outcomes for a small case, such as two dice or three coins, and see whether the formula matches. The calculator’s steps show each rule it used, so you can see where your working and its answer split.
