Amy has divided a square up into finitely many white and red rectangles, each with sides parallel to the sides of the square. Within each white rectangle, she writes down its width divided by its height. Within each red rectangle, she writes down its height divided by its width. Finally, she calculates \( x \), the sum of these numbers. If the total area of the white rectangles equals the total area of the red rectangles, what is the smallest possible value of \( x \)?
Let $a_{i}$ and $b_{i}$ denote the width and height of each white rectangle, and let $c_{i}$ and $d_{i}$ denote the width and height of each red rectangle. Also, let $L$ denote the side length of the original square.

Lemma: Either $\sum a_{i} \geq L$ or $\sum d_{i} \geq L$.

Proof of lemma: Suppose there exists a horizontal line across the square that is covered entirely with white rectangles. Then, the total width of these rectangles is at least $L$, and the claim is proven. Otherwise, there is a red rectangle intersecting every horizontal line, and hence the total height of these rectangles is at least $L$.

Now, let us assume without loss of generality that $\sum a_{i} \geq L$. By the Cauchy-Schwarz inequality,

$$
\begin{aligned}
\left(\sum \frac{a_{i}}{b_{i}}\right) \cdot\left(\sum a_{i} b_{i}\right) & \geq\left(\sum a_{i}\right)^{2} \\
& \geq L^{2}
\end{aligned}
$$

But we know $\sum a_{i} b_{i}=\frac{L^{2}}{2}$, so it follows that $\sum \frac{a_{i}}{b_{i}} \geq 2$. Furthermore, each $c_{i} \leq L$, so

$$
\sum \frac{d_{i}}{c_{i}} \geq \frac{1}{L^{2}} \cdot \sum c_{i} d_{i}=\frac{1}{2}
$$

Therefore, $x$ is at least 2.5. Conversely, $x=2.5$ can be achieved by making the top half of the square one colour, and the bottom half the other colour.