### Funny Theorems/Conclusions

• Shoelace formula wiki

Shoelace fomular is an efficient solution to calculate the area of a simple polygon whose vertices are described in the clockwise or counterclockwise direction.

\begin{aligned} \mathbf { Area } &= \frac { 1 } { 2 } | \sum _ { i = 1 } ^ { n - 1 } x _ { i } y _ { i + 1 } + x _ { n } y _ { 1 } - \sum _ { i = 1 } ^ { n - 1 } x _ { i + 1 } y _ { i } - x _ { 1 } y _ { n } | \\ &= \frac { 1 } { 2 } | x _ { 1 } y _ { 2 } + x _ { 2 } y _ { 3 } + \cdots + x _ { n - 1 } y _ { n } + x _ { n } y _ { 1 } - x _ { 2 } y _ { 1 } - x _ { 3 } y _ { 2 } - \cdots - x _ { n } y _ { n - 1 } - x _ { 1 } y _ { n } | \end{aligned}

This expression is extremely better than Heron’s formular especially in the aspect of precision when it comes to triangles.

### Funny Problems

• Cat and Mouse

A game on an undirected graph with no more than 50 nodes is played by two players, Mouse and Cat, who alternate turns. At begining, Mouse and Cat are at node 1 and node 2, respectively, and Mouse moves first. There is a Hole at node 0. During each player’s turn, they must travel along one edge of the graph that meets where they are. Additionally, it is not allowed for the Cat to travel to the Hole (node 0.) Then, the game can end in 3 ways:

• If ever the Cat occupies the same node as the Mouse, the Cat wins.
• If ever the Mouse reaches the Hole, the Mouse wins.
• If ever a position is repeated (ie. the players are in the same position as a previous turn, and it is the same player’s turn to move), the game is a draw.

Given a graph, and assuming both players play optimally, return 1 if the game is won by Mouse, 2 if the game is won by Cat, and 0 if the game is a draw.

• Coupon Collector’s Problem

The Coupon Collector’s Problem can be discribed as below. You have a dice with n faces. The i-th face has i dots. It is guaranteed that when the dice is tossed, every face appears with equal probability $\frac{1}{n}$. Now the question comes: what is the expectation of times that you need to toss the dice to ensure each face appearing at least once?

Let $E(n)$ be the expectation of n faces dice. Let $t_i$ be the time to make sure $i$ different faces appearing at least once. Observe that the probability of the appearance of a new face is $p_i=\frac{n-(i-1)}{n}$. Therefore, $t_i$ has geometric distribution with expectation $\frac{1}{p_i}$. By the linearity of expectation we have:

\begin{aligned} E(n)&=E(t_1) + E(t_2) + \cdots + E(t_n) \\ &=\frac{1}{p_1}+\frac{1}{p_2}+\cdots + \frac{1}{p_n} \\ &= \frac{n}{n} + \frac{n}{n-1} + \cdots + \frac{n}{1} \\ &= n \times (\frac{1}{1} + \frac{1}{2} + \cdots + \frac{1}{n})\\ &=n\times H_n \end{aligned}
Here $H_n$is the n-the harmonic number. Using the asymptotics of the harmonic numbers, we obtain:
$$E(n)=n\times H_n = n\log n + \gamma n + \frac{1}{2} + o(1) (n\rightarrow \infty)$$
where $\gamma \approx 0.5772156649$ is the Euler-Mascheroni constant.