## $13^{\text {th }}$ Annual Harvard-MIT Mathematics Tournament Saturday 20 February 2010 ## Combinatorics Subject Test 1. [2] Let $S=\{1,2,3,4,5,6,7,8,9,10\}$. How many (potentially empty) subsets $T$ of $S$ are there such that, for all $x$, if $x$ is in $T$ and $2 x$ is in $S$ then $2 x$ is also in $T$ ? Answer: 180 We partition the elements of $S$ into the following subsets: $\{1,2,4,8\},\{3,6\},\{5,10\}$, $\{7\},\{9\}$. Consider the first subset, $\{1,2,4,8\}$. Say 2 is an element of $T$. Because $2 \cdot 2=4$ is in $S, 4$ must also be in $T$. Furthermore, since $4 \cdot 2=8$ is in $S, 8$ must also be in $T$. So if $T$ contains 2 , it must also contain 4 and 8 . Similarly, if $T$ contains 1 , it must also contain 2,4 , and 8 . So $T$ can contain the following subsets of the subset $\{1,2,4,8\}$ : the empty set, $\{8\},\{4,8\},\{2,4,8\}$, or $\{1,2,4,8\}$. This gives 5 possibilities for the first subset. In general, we see that if $T$ contains an element $q$ of one of these subsets, it must also contain the elements in that subset that are larger than $q$, because we created the subsets for this to be true. So there are 3 possibilities for $\{3,6\}, 3$ for $\{5,10\}, 2$ for $\{7\}$, and 2 for $\{9\}$. This gives a total of $5 \cdot 3 \cdot 3 \cdot 2 \cdot 2=180$ possible subsets $T$. 2. [3] How many positive integers less than or equal to 240 can be expressed as a sum of distinct factorials? Consider 0! and 1! to be distinct. Answer: 39 Note that $1=0!, 2=0!+1!, 3=0!+2$ !, and $4=0!+1!+2$ !. These are the only numbers less than 6 that can be written as the sum of factorials. The only other factorials less than 240 are $3!=6,4!=24$, and $5!=120$. So a positive integer less than or equal to 240 can only contain 3 !, 4 !, 5 !, and/or one of $1,2,3$, or 4 in its sum. If it contains any factorial larger than 5 !, it will be larger than 240 . So a sum less than or equal to 240 will will either include 3 ! or not ( 2 ways), 4 ! or not ( 2 ways), 5 ! or not ( 2 ways), and add an additional $0,1,2,3$ or 4 ( 5 ways). This gives $2 \cdot 2 \cdot 2 \cdot 5=40$ integers less than 240 . However, we want only positive integers, so we must not count 0 . So there are 39 such positive integers. 3. [4] How many ways are there to choose 2010 functions $f_{1}, \ldots, f_{2010}$ from $\{0,1\}$ to $\{0,1\}$ such that $f_{2010} \circ f_{2009} \circ \cdots \circ f_{1}$ is constant? Note: a function $g$ is constant if $g(a)=g(b)$ for all $a, b$ in the domain of $g$. Answer: $4^{2010}-2^{2010}$ If all 2010 functions are bijective ${ }^{1}$, then the composition $f_{2010} \circ f_{2009} \circ \cdots \circ f_{1}$ will be bijective also, and therefore not constant. If, however, one of $f_{1}, \ldots, f_{2010}$ is not bijective, say $f_{k}$, then $f_{k}(0)=f_{k}(1)=q$, so $f_{2010} \circ f_{2009} \circ \cdots \circ f_{k+1} \circ f_{k} \circ \cdots f_{1}(0)=f_{2010} \circ f_{2009} \circ \cdots \circ f_{k+1}(q)=$ $f_{2010} \circ f_{2009} \circ \cdots \circ f_{k+1} \circ f_{k} \circ \cdots f_{1}(1)$. So the composition will be constant unless all $f_{i}$ are bijective. Since there are 4 possible functions ${ }^{2}$ from $\{0,1\}$ to $\{0,1\}$ and 2 of them are bijective, we subtract the cases where all the functions are bijective from the total to get $4^{2010}-2^{2010}$. 4. [4] Manya has a stack of $85=1+4+16+64$ blocks comprised of 4 layers (the $k$ th layer from the top has $4^{k-1}$ blocks; see the diagram below). Each block rests on 4 smaller blocks, each with dimensions half those of the larger block. Laura removes blocks one at a time from this stack, removing only blocks that currently have no blocks on top of them. Find the number of ways Laura can remove precisely 5 blocks from Manya's stack (the order in which they are removed matters). ![](https://cdn.mathpix.com/cropped/2025_01_24_25004d948fc0491e6f6cg-1.jpg?height=323&width=326&top_left_y=2061&top_left_x=935) Answer: 3384 Each time Laura removes a block, 4 additional blocks are exposed, increasing the total number of exposed blocks by 3 . She removes 5 blocks, for a total of $1 \cdot 4 \cdot 7 \cdot 10 \cdot 13$ ways. However, the stack originally only has 4 layers, so we must subtract the cases where removing a block on the bottom layer does not expose any new blocks. There are $1 \cdot 4 \cdot 4 \cdot 4 \cdot 4=256$ of these (the last factor of 4 is from the 4 blocks that we counted as being exposed, but were not actually). So our final answer is $1 \cdot 4 \cdot 7 \cdot 10 \cdot 13-1 \cdot 4 \cdot 4 \cdot 4 \cdot 4=3384$. 5. [5] John needs to pay 2010 dollars for his dinner. He has an unlimited supply of 2, 5, and 10 dollar notes. In how many ways can he pay? Answer: 20503 Let the number of 2,5 , and 10 dollar notes John can use be $x, y$, and $z$ respectively. We wish to find the number of nonnegative integer solutions to $2 x+5 y+10 z=2010$. Consider this equation $\bmod 2$. Because $2 x, 10 z$, and 2010 are even, $5 y$ must also be even, so $y$ must be even. Now consider the equation mod 5 . Because $5 y, 10 z$, and 2010 are divisible by $5,2 x$ must also be divisible by 5 , so $x$ must be divisible by 5 . So both $2 x$ and $5 y$ are divisible by 10 . So the equation is equivalent to $10 x^{\prime}+10 y^{\prime}+10 z=2010$, or $x^{\prime}+y^{\prime}+z=201$, with $x^{\prime}, y^{\prime}$, and $z$ nonnegative integers. There is a well-known bijection between solutions of this equation and picking 2 of 203 balls in a row on the table (explained in further detail below), so there are $\binom{203}{2}=20503$ ways. The bijection between solutions of $x^{\prime}+y^{\prime}+z=201$ and arrangements of 203 balls in a row is as follows. Given a solution of the equation, we put $x^{\prime}$ white balls in a row, then a black ball, then $y^{\prime}$ white balls, then a black ball, then $z$ white balls. This is like having 203 balls in a row on a table and picking two of them to be black. To go from an arrangement of balls to a solution of the equation, we just read off $x^{\prime}, y^{\prime}$, and $z$ from the number of white balls in a row. There are $\binom{203}{2}$ ways to choose 2 of 203 balls to be black, so there are $\binom{203}{2}$ solutions to $x^{\prime}+y^{\prime}+z=201$. 6. [5] An ant starts out at $(0,0)$. Each second, if it is currently at the square $(x, y)$, it can move to $(x-1, y-1),(x-1, y+1),(x+1, y-1)$, or $(x+1, y+1)$. In how many ways can it end up at $(2010,2010)$ after 4020 seconds? Answer: $\binom{4020}{1005}^{2}$ Note that each of the coordinates either increases or decreases the $x$ and $y$ coordinates by 1. In order to reach 2010 after 4020 steps, each of the coordinates must be increased 3015 times and decreased 1005 times. A permutation of 3015 plusses and 1005 minuses for each of $x$ and $y$ uniquely corresponds to a path the ant could take to $(2010,2010)$, because we can take ordered pairs from the two lists and match them up to a valid step the ant can take. So the number of ways the ant can end up at $(2010,2010)$ after 4020 seconds is equal to the number of ways to arrange plusses and minuses for both $x$ and $y$, or $\left(\binom{4020}{1005}\right)^{2}$. 7. [6] For each integer $x$ with $1 \leq x \leq 10$, a point is randomly placed at either $(x, 1)$ or $(x,-1)$ with equal probability. What is the expected area of the convex hull of these points? Note: the convex hull of a finite set is the smallest convex polygon containing it. Answer: $\frac{1793}{\frac{1728}{128}}$ Let $n=10$. Given a random variable $X$, let $\mathbb{E}(X)$ denote its expected value. If all points are collinear, then the convex hull has area zero. This happens with probability $\frac{2}{2^{n}}$ (either all points are at $y=1$ or all points are at $y=-1$ ). Otherwise, the points form a trapezoid with height 2 (the trapezoid is possibly degenerate, but this won't matter for our calculation). Let $x_{1, l}$ be the $x$-coordinate of the left-most point at $y=1$ and $x_{1, r}$ be the $x$-coordinate of the right-most point at $y=1$. Define $x_{-1, l}$ and $x_{-1, r}$ similarly for $y=-1$. Then the area of the trapezoid is $$ 2 \cdot \frac{\left(x_{1, r}-x_{1, l}\right)+\left(x_{-1, r}-x_{-1, l}\right)}{2}=x_{1, r}+x_{-1, r}-x_{1, l}-x_{-1, l} . $$ The expected area of the convex hull (assuming the points are not all collinear) is then, by linearity of expectation, $$ \mathbb{E}\left(x_{1, r}+x_{-1, r}-x_{1, l}-x_{-1, l}\right)=\mathbb{E}\left(x_{1, r}\right)+\mathbb{E}\left(x_{-1, r}\right)-\mathbb{E}\left(x_{1, l}\right)-\mathbb{E}\left(x_{-1, l}\right) . $$ We need only compute the expected values given in the above equation. Note that $x_{1, r}$ is equal to $k$ with probability $\frac{2^{k-1}}{2^{n}-2}$, except that it is equal to $n$ with probability $\frac{2^{n-1}-1}{2^{n}-2}$ (the denominator is $2^{n}-2$ instead of $2^{n}$ because we need to exclude the case where all points are collinear). Therefore, the expected value of $x_{1, r}$ is equal to $$ \begin{aligned} & \frac{1}{2^{n}-2}\left(\left(\sum_{k=1}^{n} k \cdot 2^{k-1}\right)-n \cdot 1\right) \\ & \quad=\frac{1}{2^{n}-2}\left(\left(1+2+\cdots+2^{n-1}\right)+\left(2+4+\cdots+2^{n-1}\right)+\cdots+2^{n-1}-n\right) \\ & =\frac{1}{2^{n}-2}\left(\left(2^{n}-1\right)+\left(2^{n}-2\right)+\cdots+\left(2^{n}-2^{n-1}\right)-n\right) \\ & =\frac{1}{2^{n}-2}\left(n \cdot 2^{n}-\left(2^{n}-1\right)-n\right) \\ & \quad=(n-1) \frac{2^{n}-1}{2^{n}-2} \end{aligned} $$ Similarly, the expected value of $x_{-1, r}$ is also $(n-1) \frac{2^{n}-1}{2^{n}-2}$. By symmetry, the expected value of both $x_{1, l}$ and $x_{-1, l}$ is $n+1-(n-1) \frac{\frac{2}{n}^{n}-1}{2^{n}-2}$. This says that if the points are not all collinear then the expected area is $2 \cdot\left((n-1) \frac{2^{n}-1}{2^{n-1}-1}-(n+1)\right)$. So, the expected area is $$ \begin{aligned} \frac{2}{2^{n}} \cdot 0+(1- & \left.\frac{2}{2^{n}}\right) \cdot 2 \cdot\left((n-1) \frac{2^{n}-1}{2^{n-1}-1}-(n+1)\right) \\ & =2 \cdot \frac{2^{n-1}-1}{2^{n-1}} \cdot\left((n-1) \frac{2^{n}-1}{2^{n-1}-1}-(n+1)\right) \\ & =2 \cdot \frac{(n-1)\left(2^{n}-1\right)-(n+1)\left(2^{n-1}-1\right)}{2^{n-1}} \\ & =2 \cdot \frac{((2 n-2)-(n+1)) 2^{n-1}+2}{2^{n-1}} \\ & =2 n-6+\frac{1}{2^{n-3}} \end{aligned} $$ Plugging in $n=10$, we get $14+\frac{1}{128}=\frac{1793}{128}$. 8. [6] How many functions $f$ from $\{-1005, \ldots, 1005\}$ to $\{-2010, \ldots, 2010\}$ are there such that the following two conditions are satisfied? - If $a