New: 6 free SQL practice datasets with 300+ questions — try the SQL Compiler →
Statistics

Probability Basics for Data Analysis

Probability basics explained: addition and multiplication rules, conditional probability, Bayes' theorem, and permutations versus combinations.

Upskly AI Team October 5, 2026 9 min read
Probability Basics for Data Analysis

Most statistics eventually comes down to a probability calculation underneath, and most probability mistakes come down to the same handful of mix-ups: adding when you should multiply, treating dependent events as independent, or trusting a test’s accuracy figure over what Bayes’ theorem actually says. This works through the rules with real numbers, not just the formulas.

In this guide

Probability and sample space

Probability is the number of favourable outcomes divided by the total number of possible outcomes, always landing somewhere from 0 (impossible) to 1 (certain). The sample space is the complete set of every possible outcome an experiment could produce, rolling a die has the sample space 1 through 6, and every probability calculation starts from that full list.

Probability is always favourable outcomes over total outcomes
QuestionCalculationProbability
Rolling a 4 on a fair die1 out of 6 faces0.167
Drawing a heart from a standard deck13 out of 52 cards0.25

The addition rule and the multiplication rule

Two events are mutually exclusive when they cannot both happen at once, rolling a 2 and rolling a 5 on the same die roll, for instance. For an ‘or’ between mutually exclusive events, probabilities simply add. For an ‘and’ between independent events, probabilities multiply.

Add for 'or', multiply for 'and' (when the events qualify)
RuleWhen it appliesExampleResult
Addition'Or' between mutually exclusive eventsRolling a 2 or a 5 on one die1/6 + 1/6 = 0.333
Multiplication'And' between independent eventsRolling a 6 on two separate dice1/6 x 1/6 = 0.028

When two events can overlap, ‘or’ needs one more step: add each probability, then subtract the overlap once so it is not double-counted. A card that is a heart or a face card overlaps on exactly 3 cards, the heart jack, queen and king, so the probability is 13/52 plus 12/52 minus 3/52, which is 0.423, not the 0.481 you would get by just adding the two parts.

Independent versus dependent events

Events are independent when the outcome of one has no effect at all on the probability of the other, two separate coin flips, for instance. Events are dependent when one outcome changes the probability of the other, drawing cards without replacement is the classic case.

Same action, two draws, different relationship
ScenarioRelationshipWhy
Two dice rolled at the same timeIndependentNeither roll affects the other
Two cards drawn without replacementDependentRemoving the first card changes what remains for the second

Drawing two hearts in a row without replacement shows the effect directly: the first draw has a 13 in 52 chance, but once that card is gone, only 12 hearts remain among 51 cards for the second draw, giving 13/52 x 12/51, which is 0.059, not the 0.0625 you would get by wrongly treating the two draws as independent (13/52 x 13/52).

Can an event be both?

No. If two events with real, nonzero probability are mutually exclusive, then one happening makes the other impossible, P(A given B) is 0, not equal to the plain P(A) as independence would require. Mutually exclusive and independent describe different, incompatible relationships, not two labels for the same thing.

Conditional probability

Conditional probability asks how likely one event is, given that another is already known to have happened. It narrows the sample space down to only the outcomes where the known condition is true, then asks how likely the other event is inside that smaller space.

200 employees across two departments
Completed trainingNot yet trainedTotal
Department A9030120
Department B503080
Total14060200
Conditioning on different information changes the answer
QuestionCalculationResult
P(Department A given trained)90 out of 140 trained employees0.643
P(trained given Department B)50 out of 80 Department B employees0.625
Overall P(Department A), no condition120 out of 200 employees0.600

P(Department A given trained) comes out to 0.643, noticeably higher than the plain, unconditional P(Department A) of 0.600. That 0.043 gap is itself informative: if knowing someone was trained did not shift the odds they are from Department A at all, department and training would be independent here, and they are not.

Bayes’ theorem: why 95 percent accurate is not what it sounds like

Bayes’ theorem updates a prior probability, what was believed before new evidence, into a posterior probability, the revised belief after taking that evidence into account.

A disease test that sounds reliable

A disease affects 1 percent of a population. A test correctly detects it 95 percent of the time when present, and gives a false positive 5 percent of the time when absent. If someone tests positive, what is the real probability they have the disease?

Bayes' theorem applied to the disease test
ComponentValue
Chance of a true positive (has disease and tests positive)0.95 x 0.01 = 0.0095
Chance of a false positive (no disease but tests positive)0.05 x 0.99 = 0.0495
Total chance of any positive result0.0095 + 0.0495 = 0.059
P(disease given positive test)0.0095 / 0.059 = 0.161

Despite a test that sounds 95 percent accurate, a positive result only means a 16.1 percent real chance of having the disease, because the disease is rare to begin with, so false positives from the large healthy majority outnumber true positives from the small affected minority. The same logic runs the other way too: in a factory where Machine X makes 60 percent of parts at a 2 percent defect rate and Machine Y makes the remaining 40 percent at a 5 percent defect rate, a randomly chosen defective part has a 0.625 probability of having come from Machine Y, even though Machine Y makes fewer parts overall, because its higher defect rate contributes more than its smaller share would suggest.

Permutations versus combinations

A permutation counts arrangements where order matters. A combination counts selections where it does not.

Same-sized groups, different counts, because order matters in only one of them
ScenarioOrder matters?TypeCalculationCount
Choosing a 3-person committee from 8 peopleNoCombination8 choose 356
Arranging 4 distinct books on a shelfYesPermutation4 factorial24

A three-digit code built from three distinct digits is a permutation, not a combination, because 123 and 321 use exactly the same digits but count as two different codes. A committee has no such distinction, three people chosen in any order form the same committee.

Common mistakes

  • Adding probabilities for an ‘and’, or multiplying for an ‘or’. The words in the question decide the operation, and getting them backwards gives an impossible-looking or simply wrong answer.
  • Forgetting to subtract the overlap in an inclusive ‘or’. Events that can both happen need their shared outcomes subtracted once, or the answer double-counts them.
  • Treating a without-replacement draw as independent. Removing an item changes the odds for every draw after it; the second card, marble or part is never drawn from the original, untouched pool.
  • Trusting a test’s advertised accuracy as the real probability of a positive result being correct. When the underlying condition is rare, Bayes’ theorem can put the real figure far below the test’s own accuracy rate, exactly as the disease example shows.
  • Mixing up permutations and combinations. If swapping the order of the same items would create a genuinely different outcome, it is a permutation; if it would not, it is a combination.

Cheat sheet

Quick answers
QuestionAnswer
When do probabilities add?An 'or' between mutually exclusive events
When do probabilities multiply?An 'and' between independent events
What is the complement rule?P(not A) = 1 minus P(A)
What makes two events dependent?One outcome changes the probability of the other
What does conditional probability narrow down?The sample space, to only where the given condition is true
What does Bayes' theorem update?A prior probability into a posterior probability, using new evidence
What does a permutation count?Arrangements where order matters
What does a combination count?Selections where order does not matter
What is the valid range for any probability?0 to 1, inclusive
Can mutually exclusive events also be independent?No, not if both have nonzero probability

Try it yourself

Quick check

A bag holds 5 red marbles and 3 blue marbles. Two marbles are drawn one after another, without putting the first one back. What is the probability that both are red (3 dp)?

Show answer

0.357. The first draw has a 5 in 8 chance of being red. Since the marble is not replaced, the second draw only has 4 red marbles left among 7 total, so the probability is 5/8 x 4/7, which is 0.357. Treating the draws as independent would wrongly give 5/8 x 5/8, which is 0.391, too high, because it ignores that the pool shrank after the first draw.

Frequently asked questions

What is the difference between mutually exclusive and independent events?

Mutually exclusive events cannot both happen at once, so their joint probability is zero. Independent events can both happen, but one happening does not change the probability of the other. Two events with nonzero probability cannot be both at the same time.

What is the addition rule in probability?

For mutually exclusive events, the probability of either happening is the sum of their individual probabilities. If the events can overlap, their shared outcomes must be subtracted once to avoid double-counting.

What is the multiplication rule in probability?

For independent events, the probability of both happening is the product of their individual probabilities. For dependent events, the second event’s probability must be recalculated based on what the first event already changed.

What does Bayes’ theorem actually calculate?

It converts a prior probability into a posterior probability by combining it with how likely the observed evidence is under each possible cause, which is why a positive result on an accurate test can still carry a low real probability when the underlying condition is rare.

How do you tell a permutation apart from a combination?

If rearranging the same items would create a genuinely different outcome, such as a code or a queue order, it is a permutation. If the order makes no difference, such as choosing a committee, it is a combination.

Why does conditional probability give a different answer from the plain, unconditional probability?

Conditional probability restricts the sample space down to only the outcomes where the known condition is true, so it reflects a different, smaller population than the overall probability does, and the two only match when the condition and the event are independent.

Test yourself

Timed questions on Probability Basics, with an explanation for every answer.

Take the Quiz
Upskly AI Team
Learning made simple
Scroll to Top