Double Counting Notes by Victoria Krakovna

by SomeonecoolLovesMaths, Mar 12, 2025, 2:46 PM

In many combinatorics problems, it is useful to count a quantity in two ways. Let’s start with a simple example.

$\textbf{Example 1.}$ (Iran 2010 \#2) There are $n$ points in the plane such that no three of them are collinear. Prove that the number of triangles, whose vertices are chosen from these $n$ points and whose area is $1$, is not greater than $\frac{2}{3}(n^2 - n)$.

$\textit{Solution.}$ Let the number of such triangles be $k$. For each edge between two points in the set we count the number of triangles it is part of. Let the total number over all edges be $T$.

On the one hand, for any edge $AB$, there are at most $4$ points such that the triangles they form with $A$ and $B$ have the same area. This is because those points have to be the same distance from line $AB$, and no three of them are collinear. Thus, $T \leq 4\binom{n}{2}$. On the other hand, each triangle has $3$ edges, so $T \geq 3k$. Thus,
\[
k \leq \frac{T}{3} \leq \frac{4}{3} \binom{n}{2} = \frac{2}{3}(n^2 - n).
\]
It’s a good idea to consider double counting if the problem involves a pairing like students and committees, or an array of numbers; it’s also often useful in graph theory problems.

$\textbf{Example 2.}$ (IMO 1987 #1) Let $p_n(k)$ be the number of permutations of the set $\{1, 2, 3, \dots, n\}$ which have exactly $k$ fixed points. Prove that
\[
\sum_{k=0}^{n} k \cdot p_n(k) = n!.
\]
$\textit{Solution.}$ The first idea that might occur here would be to find $p_n(k)$, then multiply it by $k$, sum it up… probably resulting in a big expression. However, if we look at the required result, we see that it suggests a natural counting — the left-hand side is the total number of fixed points over all permutations. Another way to obtain that is to consider that each element of $\{1, 2, 3, \dots, n\}$ is a fixed point in $(n-1)!$ permutations, so the total is $n(n - 1)! = n!$. (Note that we are counting pairs of the form (point, permutation) such that the point is a fixed point of the permutation.) $\square$

$\bigskip$

$\textbf{Example 3.}$ (China Hong Kong MO 2007) In a school there are 2007 girls and 2007 boys. Each student joins no more than 100 clubs in the school. It is known that any two students of opposite genders have joined at least one common club. Show that there is a club with at least 11 boys and 11 girls.

$\textit{Solution.}$ Since we are only given information about club membership of students of different gender, this suggests that we should consider triples of the form (boy, girl, club), where the boy and girl both attend the club. Let the total number of such triples be $T$.

For each pair (boy, girl), we know that they attend at least one club together, so since there are $2007^2$ such pairs,
\[
T \ge 2007^2 \cdot 1.
\]
Assume that there is no club with at least 11 boys and 11 girls. Let $X$ be the number of triples involving clubs with at most 10 boys, and $Y$ be the number of triples involving clubs with at most 10 girls. Since any student is in at most 100 clubs, the number of (girl, club) pairs is at most $2007 \cdot 100$, so $X \le 2007 \cdot 100 \cdot 10$. Similarly, $Y \le 2007 \cdot 100 \cdot 10$. Then,
\[
2007^2 \le T \le X + Y \le 2 \cdot 2007 \cdot 1000 = 2007 \cdot 2000
\]which is a contradiction. $\square$

$\textbf{Theorem: } \textit{(Fermat’s Little Theorem)}$ If $a$ is an integer and $p$ is a prime, then
\[
a^p \equiv a \pmod{p}.
\]
$\textit{Proof.}$ Consider the set of strings of length $p$ using an alphabet with $a$ different symbols. Note that these strings can be separated into equivalence classes, where two strings are equivalent if they are rotations of each other. Here is an example of such an equivalence class (called a "necklace") for $p = 5$:
\[
\{ \text{BCCCB}, \text{CCBCB}, \text{CBBCC}, \text{BBCCC}, \text{CCCBB} \}.
\]
Let’s call a string with at least two distinct symbols in it \textit{non-trivial}. All the rotations of a non-trivial string are distinct — since $p$ is prime, a string cannot consist of several identical substrings of size greater than $1$. Thus, all the equivalence classes have size $p$, except for those formed from a trivial string, which have size $1$.

Thus, there are two ways to count the number of non-trivial strings. Since there are $a^p$ strings in total, $a$ of which are trivial, we have $a^p - a$ non-trivial strings. Also, the number of non-trivial strings is $p$ times the number of equivalence classes formed by non-trivial strings. Therefore, $p$ divides $a^p - a$. $\square$


might contain mistakes

Comment

1 Comment

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Here is my favorite double counting proof:

Suppose a committee consists of $m$ men and $n$ women. Then the number of ways of forming a sub-committee of size $r$ is:

$$\binom{m+n}{k}$$
Suppose instead we picked $k$ men at a time, and $r-k$ women. The number of ways of doing this is:

$$\binom{m}{k} \binom{n}{r-k}$$
Now the sum of this over $k$ must be equal to the earlier quantity:

$$\binom{m+n}{k} = \sum_{k=0}^r \binom{m}{k} \binom{n}{r-k}$$
this is known as the Vandermonde identity :D

by quasar_lord, Mar 12, 2025, 5:32 PM

My First Blog

avatar

SomeonecoolLovesMaths
Shouts
Submit
  • I will bookmarked this blog

    by giangtruong13, Yesterday at 7:37 AM

  • W blog op

    by quasar_lord, Mar 10, 2025, 5:32 PM

  • orz blog
    how so orzzzz

    by Erratum, Jan 31, 2025, 9:47 AM

  • shouts; your post is too short , it must be atleast 8 characters

    by mqoi_KOLA, Dec 5, 2024, 6:37 PM

  • Guys it took my like 10 hours to do this! Idk why did I even do this, but now it looks kinda satisfying ngl.

    by SomeonecoolLovesMaths, Nov 25, 2024, 5:07 PM

  • add this one new thing to the intergrals that is lim n tends to infinity b-a/n summation k=1 to n f(a+k(b-a)/n))= int_{a}^b f(x) dx

    by Levieee, Nov 21, 2024, 8:37 PM

  • woahh hi HSM main orz blog!!!

    by eg4334, Nov 17, 2024, 3:31 PM

  • Me in 4 years of Aops - 555 posts.

    This guy in 10 months of Aops - 2608 posts

    by HoRI_DA_GRe8, Oct 17, 2024, 10:22 AM

  • Remember; the one who falls and gets back up is stronger than the ones who never tried... Good luck for next year's IOQM

    by alexanderhamilton124, Oct 15, 2024, 7:03 AM

  • fourth shout

    by QueenArwen, Sep 2, 2024, 4:05 PM

  • Hii
    !!!!!!!!!!!

    by Yummo, Apr 2, 2024, 2:43 PM

  • i am shouting. it is very loud.

    by fruitmonster97, Mar 21, 2024, 7:49 PM

  • real!!!!!

    by SirAppel, Mar 17, 2024, 6:22 PM

13 shouts
Tags
About Owner
  • Posts: 3139
  • Joined: Dec 22, 2023
Blog Stats
  • Blog created: Mar 17, 2024
  • Total entries: 20
  • Total visits: 1249
  • Total comments: 19
Search Blog