Beginner

Venn Diagram Calculator — Two-Set Union, Intersection & Probability

Enter the sizes of two sets A and B, their intersection, and the total universe — and get the union, the four Venn regions, all probabilities, and conditional probabilities P(A|B) and P(B|A).
Size of set A
Size of set B
Elements belonging to both A and B
Total elements in the universe (sample space)
n(A∪B) — Union
60

Elements in A or B or both: n(A) + n(B) − n(A∩B)

n(A only)
20
n(A∩B)
10
n(B only)
30
Neither (outside A∪B)
40
P(A)
30%
P(B)
40%
P(A∩B)
10%
P(A∪B)
60%
P(A|B)
25%
P(B|A)
33.3%

60

in union

A only

20%

A∩B

10%

B only

30%

Neither

40%

Step by step
  1. 1

    n(A) + n(B)

    30 + 40 = 70
  2. 2

    n(A∪B) — subtract intersection

    70 − n(A∩B) = 70 − 10 = 60
    Subtracting A∩B removes elements counted twice (inclusion-exclusion principle).
Results are estimates for general information only and are not professional advice — always verify important results independently before relying on them. Read the full disclaimer.
Quick answer

How does this calculator work?

n(A∪B) = n(A) + n(B) − n(A∩B). The four Venn regions are A only, A∩B, B only, and neither. Divide by universe size N to get probabilities. Conditional: P(A|B) = n(A∩B)/n(B). Enter all four counts to get every set and probability result instantly.

Formula
n(A∪B) = n(A) + n(B) − n(A∩B) • P(A|B) = n(A∩B) / n(B)
How this is calculated

A Venn diagram partitions a universal set of N elements into four mutually exclusive regions: elements in A only, elements in B only, elements in both A and B (the intersection A∩B), and elements in neither. The inclusion-exclusion principle gives the union n(A∪B) = n(A) + n(B) − n(A∩B); subtracting the intersection prevents double-counting the shared elements.

Probabilities are found by dividing each count by the universe size N. P(A∩B) is the probability that a randomly chosen element belongs to both sets, and P(A∪B) is the probability it belongs to at least one. The conditional probability P(A|B) — "the probability of A given B" — equals n(A∩B) / n(B): among elements already known to be in B, what fraction are also in A? Similarly P(B|A) = n(A∩B) / n(A).

This calculator handles two-set scenarios. For three sets add a second calculation step using the three-set inclusion-exclusion formula: n(A∪B∪C) = n(A)+n(B)+n(C) − n(A∩B) − n(A∩C) − n(B∩C) + n(A∩B∩C).

Frequently asked questions

When you add n(A) and n(B), elements in the intersection A∩B are counted twice. Subtracting n(A∩B) once corrects this, giving the true union size. This generalises: for three sets you subtract all three pairwise intersections and add back the triple intersection.

P(A∩B) is the probability that a randomly chosen element from the whole universe is in both A and B. P(A|B) is the probability it is in A given that you already know it is in B — a conditional or restricted probability. P(A|B) = P(A∩B) / P(B), so it is always ≥ P(A∩B) (unless P(B) = 1).

A and B are statistically independent when P(A∩B) = P(A) × P(B), equivalently when P(A|B) = P(A). If the calculator shows P(A|B) equals P(A) in the results, the two sets are independent in that universe.

Also known as

venn diagram set calculator
union intersection probability calculator
two set inclusion exclusion
p a or b calculator
set theory union intersection
conditional probability venn diagram
a union b calculator

APA

TG we-Calculate Editorial Team. (2026). Venn Diagram Calculator — Two-Set Union, Intersection & Probability [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/venn-diagram-calculator

Chicago

TG we-Calculate Editorial Team. "Venn Diagram Calculator — Two-Set Union, Intersection & Probability." TG we-Calculate. 2026. https://we-calculate.com/calculator/venn-diagram-calculator.

IEEE

TG we-Calculate Editorial Team, "Venn Diagram Calculator — Two-Set Union, Intersection & Probability," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/venn-diagram-calculator

BibTeX

@misc{wecalculate_venn_diagram_calculator, title = {Venn Diagram Calculator — Two-Set Union, Intersection & Probability}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/venn-diagram-calculator}}, year = {2026}, note = {TG we-Calculate} }

Did this calculator help you?