Maths Olympiad Prep

Library / /415 of 462

Combinatorics Difficulty 7.1 National Olympiad, round 2 Prove it Ireland

There is a n×nn \times n square forest grid in which you wish to grow a forest. You have n2n^2 saplings (young trees) so that the ii-th sapling, once planted, will grow to a tree of height exactly ii metres tall. Each sapling has to be planted in a different square of the forest grid. A balanced forest is one in which for every tree in the forest at least one of the following conditions holds true:
* There exists a smaller tree in the same column.
* There exists a taller tree in the same row.
In how many ways can you grow a balanced forest?

Solution

The number of ways to grow a forest that may or may not be balanced is equal to n2!n^2!. To answer the question we will first count the unbalanced forests, then subtract.

The main observation is that an unbalanced forest contains exactly one tree that violates both conditions. Indeed, if there were two such trees, say of heights ii and jj, then they cannot be in the same row or same column since iji \neq j. If tree ii is in square (a,b)(a, b), then ii is the tallest tree in row aa and the smallest tree in column bb. Similarly, if tree jj is at position (m,n)(m, n), then jj is the tallest tree in row mm and the smallest tree in column nn. Therefore, if the tree in square (a,n)(a, n) has size uu, then j<u<ij < u < i, hence j<ij < i. If the tree in square (m,b)(m, b) has size vv, then i<v<ji < v < j, a contradiction.

To plant an unbalanced forest, there are n2n^2 possible choices for the square with the tree that violates both conditions. The row and column that contain this square will together accommodate 2n12n-1 trees. There are (n22n1)\binom{n^2}{2n-1} possible choices for these trees. Once we have chosen 2n12n-1 numbers, the middle value (with n1n-1 smaller and n1n-1 larger numbers in the chosen set) has to become the tree that violates both conditions. The n1n-1 smaller trees can be planted in (n1)!(n-1)! ways in their row and similarly for the larger trees.

The remaining n2(2n1)=(n1)2n^2 - (2n-1) = (n-1)^2 trees can be planted as we like in the remaining squares of the grid. We have (n1)2!(n-1)^2! possibilities for that. In total we find that there are
n2(n22n1)((n1)!)2(n1)2! n^2 \cdot \binom{n^2}{2n-1} \cdot ((n-1)!)^2 \cdot (n-1)^2!
ways to plant an unbalanced forest, hence the number of ways to plant a balanced forest is equal to
n2!n2(n22n1)((n1)!)2(n1)2! n^2! - n^2 \cdot \binom{n^2}{2n-1} \cdot ((n-1)!)^2 \cdot (n-1)^2!

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.