How Math Works
Discrete & Logicconceptfoundations

Sets and Venn Diagrams

A union is 'add them up, then subtract the overlap once'.

The formula

n(A∪B) = n(A) + n(B) − n(A∩B)

How to read it: the size of the union is each set's size added together, minus the overlap counted once

A∪B
the union — every element in A or B
A∩B
the intersection — the elements in both A and B
n(A)
the number of elements in set A

The hook

When you count A and B together, you can't just add — that double-counts the overlap.

In plain words

The size of the union is the two sets' sizes added, then the overlap (the intersection) subtracted exactly once.

The intuition

Picture a Venn diagram of two overlapping circles. If you just add the two circles, you've counted the overlapping middle twice. Subtract it once and you get the true 'combined' amount.

How it's built

Counting A with n(A) and B with n(B) counts the intersection once from each side — twice in all. To leave it in just once, you subtract n(A∩B).

Example

In a class, 18 students like soccer, 12 like basketball, and 5 like both, so the number who like at least one is 18+12−5 = 25.

Common mistake

It's easy to drop or double-count the 'both' group. The overlap is added in twice, so it must be subtracted once.

Where it's used

Tallying surveys, sorting data, the addition rule in probability, search filters (AND/OR) — anywhere you count overlapping groups.

Where it came from

It was Cantor in the 1800s who made 'sets' a foundational language of mathematics, and John Venn who popularized drawing the overlap as circles.

Quick check

If n(A)=10, n(B)=7, and n(A∩B)=3, what is n(A∪B)?

  • 14
  • 17
  • 20
  • 3

Practice

If n(A)=8, n(B)=6, and n(A∩B)=2, find n(A∪B).

Answer: 12

Solution:
  1. Formula: n(A∪B)=n(A)+n(B)−n(A∩B)
  2. 8+6−2 = 12

Takeaway: Don't forget to subtract the overlap (the intersection) once.

In a class of 30, 14 students keep a dog, 10 keep a cat, and 4 keep both. How many keep a dog or a cat?

Answer: 20

Solution:
  1. 'a dog or a cat' = the union
  2. 14+10−4 = 20

Takeaway: 'Or' means the union — subtract the 'both' overlap once.

If n(A)=9, n(B)=5, and n(A∪B)=11, what is the intersection n(A∩B)?

Answer: 3

Solution:
  1. Rearrange the formula: n(A∩B)=n(A)+n(B)−n(A∪B)
  2. 9+5−11 = 3

Takeaway: Flip the same formula around and you can find the intersection too.

Out of 40 people, 22 like math, 18 like English, and 8 like both. On your notepad, work out how many like neither.

Answer: undefined

Solution:
  1. Like at least one (the union) = 22+18−8 = 32
  2. Like neither = total − union = 40 − 32 = 8

Takeaway: Total minus the union gives the 'neither' region outside both circles.

Related mathematicians

Keep learning in the app

Touch-and-drag widgets, self-graded practice and daily formulas — free on iOS and Android.