There are questions to answer in order to prove this algorithm:
<aside> <img src="/icons/document_gray.svg" alt="/icons/document_gray.svg" width="40px" /> Assume termination does not occur. Then at least 2 boys are under the same balcony on some day. At least one of the boys gets rejected and crosses the girl off his list. So, there are at most $N$ lists of size $N$ each, so a boy can only cross a girl at most $N^2$ times.
</aside>
Property $X$: If a girl $G$ rejects a guy $B$, she has a suitor who she prefers to $B$.
Proof by induction:
<aside> <img src="/icons/document_gray.svg" alt="/icons/document_gray.svg" width="40px" /> On day $0$, this is vacuously true—there are no boys to reject. Assume property $X$ holds for day $D$. Case 1: If $G$ rejects $B$ on day $D = 1$, by definition she has a better suitor. $\checkmark$ Case 2: If $G$ rejects $B$ on day $D < D + 1$, by definition she has a better suitor by induction. $\checkmark$
</aside>
Proof by contradiction:
<aside> <img src="/icons/document_gray.svg" alt="/icons/document_gray.svg" width="40px" /> Assume someone isn’t married. Then, there is a $B$ such that he was rejected by every girl. So, every $G$ has a suitor better than $B$. However, that implies that every $G$ is married, so every $B$ is married. We arrive at a contradiction.
</aside>
<aside> <img src="/icons/document_gray.svg" alt="/icons/document_gray.svg" width="40px" /> Take any $A$, $B$ not married. Case 1: $A$ rejected $B$, by property $X$, $A$ married someone better, so no rogue pairing. Case 2: $A$ never rejected $B$, so $B$ never serenaded $A$, so $B$ married someone of higher rank, so no rogue pairing. Hence, there are no rogue couples.
</aside>
Definition: Define the optimal person as the best choice in the “realm of possibility.”
Definition: Similarly, define the pessimal person as the worse choice in the “realm of possibility.”