Every exam season there is one problem that shows up with cricket and football, or tea and coffee, or Hindi and Sanskrit. The numbers change; the shape never does. Some students like A, some like B, some like both, some like neither — you are asked how many fall in each region of the Venn diagram.

Rather than solve one version, this page gives you a slider you can drive. Change how many students like cricket, how many like football, and how many like both — and watch the Venn diagram auto-fill in real time. When the slider values are impossible (overlap bigger than either single group), the numbers tell you so.

The rule every survey problem uses

Start with a class of N students. Let A be the set who like the first activity, B the set who like the second. Only three numbers are given:

|A|, \quad |B|, \quad |A \cap B|.

From these, every other region-count follows by subtraction.

  • Only A (left crescent): |A - B| = |A| - |A \cap B|.
  • Only B (right crescent): |B - A| = |B| - |A \cap B|.
  • At least one: |A \cup B| = |A| + |B| - |A \cap B|.
  • Neither (outside both circles): |(A \cup B)'| = N - |A \cup B|.

Why: the crescent "only A" is A with the overlap removed, so its size is |A| minus the overlap. The union adds both single counts, but because the overlap was counted twice, you subtract it once — the inclusion-exclusion formula. The "neither" region is whatever remains after the union is taken out of the universe.

That is the entire toolkit. The slider below applies it.

The auto-fill generator

Move the three sliders to set |A| (cricket fans), |B| (football fans), and |A \cap B| (both). The class has N = 100 students. Each region fills with the computed count, animated via little circles that stream into their region. When the numbers are impossible the generator says so.

Three sliders set $|A|$, $|B|$, and the overlap $|A \cap B|$. Dots stream into their Venn region — blue for only-cricket, green for only-football, purple for both, grey for neither. Totals update live and the readout flips to "IMPOSSIBLE" when the overlap exceeds either set or forces the union past $100$. This is the full inclusion-exclusion pipeline made visible.

Try it with the textbook numbers: |A| = 60, |B| = 40, |A \cap B| = 20. The Venn fills as "only cricket = 40, both = 20, only football = 20, neither = 20." Check: 40 + 20 + 20 + 20 = 100 — every student placed, no double counting.

Why the middle number cannot exceed the sides

If a student is in A \cap B, they are also in A and also in B — that is the definition of the intersection. So the overlap count has to sit under both single counts:

|A \cap B| \le |A| \quad \text{and} \quad |A \cap B| \le |B|.

The moment you drag the "both" slider above the smaller of the two set sizes, the generator marks the state as impossible. In a real survey, this failure means someone double-counted or misread the question.

The union cannot exceed the universe

Inclusion-exclusion gives |A \cup B| = |A| + |B| - |A \cap B|. If this number turns out greater than N, the data is inconsistent — more students like at least one sport than there are students in total. The fix, when this happens in an exam, is always the same: the overlap count was reported too low. Raise |A \cap B| until |A \cup B| drops to N or below.

A worked survey example

Of $100$ students, $60$ like cricket, $40$ like football, and $20$ like both. How many like neither?

Step 1. Recognise the three given numbers as |A|, |B|, |A \cap B|.

Step 2. Apply inclusion-exclusion.

|A \cup B| = 60 + 40 - 20 = 80

Why: 60 + 40 = 100 counts the students who like both twice. Subtracting 20 removes the double count. The net is the number who like at least one sport.

Step 3. Subtract from N = 100 to get "neither."

|(A \cup B)'| = 100 - 80 = 20

Result. 20 students like neither cricket nor football.

Region check. Only cricket = 60 - 20 = 40. Only football = 40 - 20 = 20. Both = 20. Neither = 20. Total = 40 + 20 + 20 + 20 = 100. Every student accounted for.

Every survey-style Venn problem in NCERT, RD Sharma, and JEE Main collapses to this same four-step routine: read three numbers, apply inclusion-exclusion, subtract from the total, check the four regions sum to N.

The three-set upgrade

When a third activity enters — badminton, say — the generator logic gets richer. You need seven numbers to fix every region: the three singles |A|, |B|, |C|, the three pairwise overlaps |A \cap B|, |A \cap C|, |B \cap C|, and the triple overlap |A \cap B \cap C|. Inclusion-exclusion for three sets,

|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |A \cap C| - |B \cap C| + |A \cap B \cap C|,

is the same idea extended one level deeper. The three-set Venn zone explorer is the matching generator for that case.

Related: Set Operations · Inclusion-Exclusion Calculator · Three-Set Venn Diagram · Animated Venn Diagrams