MathLabs

Problem 5

Let nn be a positive integer. There are n(n+1)n(n+1) rooms arranged in an (n+1)×n(n+1)\times n grid. Between every two adjacent rooms there is a door. Find the number of ways to choose a subset of doors and lock them so that there exist two rooms SS and GG satisfying: (i) SS is in the first row and GG is in the (n+1)(n+1)-th row. (ii) GG can be reached from SS using only unlocked doors.
Step 1 of 5: Reduce to a graph-reachability count
collapse row 1→A, row n+1→B;∣E(G)∣=n2+(n−1)2,free doors=2(n−1)\text{collapse row }1\to A,\ \text{row }n{+}1\to B;\quad |E(G)|=n^2+(n-1)^2,\quad \text{free doors}=2(n-1)
Detailed analysis

Since SS may be any room of the first row and GG any room of the last row, whether a suitable pair exists does not depend on which of the n−1n-1 doors joining rooms within the first row, or the n−1n-1 within the last row, are locked; there are 2(n−1)2(n-1) such free doors in total. Collapsing the first row to a single vertex AA and the last row to a single vertex BB, the remaining rooms and doors form a graph G\mathcal{G} with n2+(n−1)2n^2+(n-1)^2 edges, and the problem reduces to counting subsets HH of these edges for which AA and BB are connected in HH.