Written and maintained by CASRAI Editorial Board
Last updated
Joint probability is the probability that two events both occur in the same trial, written P(A and B), P(A ∩ B) or P(A, B). The formula depends on one question: does knowing that A happened change the chance of B? If not, multiply the two probabilities; if so, multiply P(A) by the conditional probability P(B | A). This guide gives both forms, one worked example computed from a two-way table, the independence check that most introductions skip, and short Excel, R and Python snippets.
What is joint probability?
Joint probability is the probability of two events happening together. Athabasca University’s probability tutorial puts it this way: “The probability of two events A and B happening concurrently is called the “joint probability” of the two events.” It is one of three quantities that are easy to confuse:
- Joint: P(A and B), both events occur.
- Marginal: P(A) or P(B), one event regardless of the other.
- Conditional: P(B | A), the chance of B once A is known to have occurred.
Joint probability formula
The general (dependent-events) form is the multiplication rule, which the Athabasca tutorial states in both orderings:
P(A and B) = P(A) × P(B | A) = P(B) × P(A | B)
- P(A and B): probability that A and B both occur.
- P(A), P(B): marginal probabilities of each event.
- P(B | A): probability of B given that A has occurred (read “B given A”).
A third route, also given by Athabasca, uses the union: P(A and B) = P(A) + P(B) − P(A or B). It is useful when you know the probability of “at least one”.
Joint probability of independent events
OpenStax Introductory Statistics 2e defines independence this way: “Two events A and B are independent events if the knowledge that one occurred does not affect the chance the other occurs.” Independence holds if any one of P(A | B) = P(A), P(B | A) = P(B) or P(A and B) = P(A)P(B) is true. Substituting P(B | A) = P(B) into the general rule gives the shortcut:
P(A and B) = P(A) × P(B) (independent events only)
Example: a fair die shows 4 and a fair coin lands tails. P = 1/6 × 1/2 = 1/12 ≈ 0.083.
Joint probability without replacement (dependent events)
An urn holds 4 red and 4 green balls. Drawing two red balls without replacement: P(first red) = 4/8; after one red is removed, P(second red | first red) = 3/7. So P(both red) = 4/8 × 3/7 = 12/56 = 3/14 ≈ 0.214. Treating the draws as independent would give 4/8 × 4/8 = 0.25, which is wrong.
Joint probability example from a two-way table
This example is an illustrative composite, not real survey data. Suppose 200 researchers are classified by two yes/no questions: A = pre-registered their last study, B = shared their data. The counts are:
| B: shared data | Not B | Row total | |
|---|---|---|---|
| A: pre-registered | 60 | 40 | 100 |
| Not A | 30 | 70 | 100 |
| Column total | 90 | 110 | 200 |
- Joint: P(A and B) = 60 / 200 = 0.30. The joint probability is the single cell divided by the grand total.
- Marginals: P(A) = 100 / 200 = 0.50; P(B) = 90 / 200 = 0.45.
- Conditional: P(B | A) = 60 / 100 = 0.60.
- Multiplication rule check: P(A) × P(B | A) = 0.50 × 0.60 = 0.30. Same answer.
- Other ordering: P(A | B) = 60 / 90 = 0.667, and P(B) × P(A | B) = 0.45 × 0.667 = 0.30.
- Union route: P(A or B) = (60 + 40 + 30) / 200 = 0.65, so P(A) + P(B) − P(A or B) = 0.50 + 0.45 − 0.65 = 0.30.
Interpretation: is the joint probability what you would expect?
A joint probability on its own says how common the combination is. To say whether the two events are related, compare it with the product of the marginals, the same logic as OpenStax Example 3.9 (P(G) = 0.6, P(H) = 0.5, P(G and H) = 0.3, so P(G | H) = 0.3/0.5 = 0.6 = P(G) and the events are independent). In the table above, P(A)P(B) = 0.50 × 0.45 = 0.225, but the observed P(A and B) = 0.30, so the events are not independent in this sample: pre-registration and data sharing occur together more often than independence would predict.
| Comparison | Reading |
|---|---|
| P(A and B) = P(A)P(B) | Consistent with independence (equivalently P(B | A) = P(B)). |
| P(A and B) > P(A)P(B) | The events co-occur more often than independence predicts. |
| P(A and B) < P(A)P(B) | The events co-occur less often than independence predicts. |
| P(A and B) = 0 | Mutually exclusive: the events cannot occur together. |
With a sample, differences from P(A)P(B) include sampling variation; a formal association test (such as a chi-square test of independence) is the tool for deciding whether a gap is more than chance.
Assumptions and common mistakes
- Multiplying marginals for dependent events. P(A)P(B) is valid only under independence. Draws without replacement, and any two outcomes that share a cause, are usually dependent.
- Confusing mutually exclusive with independent. OpenStax defines mutually exclusive events as ones that “cannot occur at the same time,” so P(A and B) = 0. If both have positive probability, that is the opposite of independence: knowing A occurred tells you B did not.
- Mixing up P(A and B) with P(B | A). The joint probability divides by the grand total; the conditional divides by the row (or column) total. In the table, 0.30 versus 0.60.
- Adding instead of multiplying. Addition answers “A or B”; the joint “A and B” comes from the multiplication rule.
- Conditioning on a shared consequence. Restricting a sample by something both events influence can create a spurious association; see collider bias.
How to report a joint probability (APA style)
Report the proportion as a percentage with its counts, and give the independence comparison if it matters to the argument. Illustrative wording for the table above: Of the 200 respondents, 60 (30%) had both pre-registered their study and shared their data. If the two practices were independent, the expected joint proportion would be 22.5% (50% × 45%).
How to calculate joint probability in Excel, R or Python
Excel
=COUNTIFS(A2:A201,"yes",B2:B201,"yes")/COUNTA(A2:A201)
Column A holds the pre-registered answer, column B the data-shared answer, one row per respondent. The result is 0.3 for the table above. Compare with =COUNTIF(A2:A201,"yes")/COUNTA(A2:A201)*COUNTIF(B2:B201,"yes")/COUNTA(B2:B201), which gives 0.225.
R
tab <- matrix(c(60, 30, 40, 70), nrow = 2,
dimnames = list(A = c("yes", "no"), B = c("yes", "no")))
p <- prop.table(tab) # joint probabilities
p["yes", "yes"] # 0.3
sum(p["yes", ]) * sum(p[, "yes"]) # 0.225, product of marginals
Python
n = {("yes","yes"): 60, ("yes","no"): 40, ("no","yes"): 30, ("no","no"): 70}
total = sum(n.values())
p_ab = n[("yes","yes")] / total # 0.3
p_a = (n[("yes","yes")] + n[("yes","no")]) / total # 0.5
p_b = (n[("yes","yes")] + n[("no","yes")]) / total # 0.45
print(p_ab, p_a * p_b) # 0.3 0.225
Joint probabilities are also the building blocks of simulation: a Monte Carlo simulation estimates them by counting how often events co-occur across many trials. Related topics that work with probabilities include the Brier score and logistic regression. For comparing risks between exposed and unexposed groups, see relative risk.
Joint probability FAQ
What is joint probability in simple terms?
It is the chance that two things happen together, such as a die showing 4 and a coin landing tails (1/12).
What is the joint probability formula?
P(A and B) = P(A) × P(B | A). For independent events this reduces to P(A) × P(B).
How is joint probability different from conditional probability?
Joint probability P(A and B) is relative to the whole sample; conditional probability P(B | A) is relative only to the cases where A occurred. In the example, 0.30 versus 0.60.
Can a joint probability be larger than either marginal probability?
No. P(A and B) cannot exceed P(A) or P(B), because both events happening is a subset of either one happening.
Sources
- Athabasca University, Rules of Probability tutorial, joint probability: https://www.athabascau.ca/math-site/project/tutorials/probability_rules/probabilityJP.php (checked 2026-10-29).
- Illowsky, B. & Dean, S., Introductory Statistics 2e, OpenStax, Rice University, section 3.2 Independent and Mutually Exclusive Events: https://openstax.org/books/introductory-statistics-2e/pages/3-2-independent-and-mutually-exclusive-events (checked 2026-10-29).








