Partition rectangle into finite number of squares

A rectangle with sides $x$, $y$ and $\frac{x}{y} \not \in \mathbb{Q}$ cannot be partitioned into squares. This is a classical result due to Dehn, Sprague and others.

Indeed, if we have a partition of the rectangle into squares of sizes $l_i$ we get the equality of areas $$x\cdot y = \sum l_i^2$$ This can be proved by further dissecting the rectangle along the sides of the squares and using the distributive law. The same argument in fact can be used to prove the stronger equality in the $\mathbb{Q}$-vector space $\mathbb{R}\otimes_{\mathbb{Q}}\mathbb{R}$: $$x\otimes y = \sum l_i \otimes l_i$$

Assume now $\frac{x}{y}$ is not rational. Then there exists a $\mathbb{Q}$-linear functional $\phi \colon \mathbb{R}\to \mathbb{Q}$ so that $\phi(x) = 1$ and $\phi(y)= -1$. From the above equality we obtain: $$\phi(x) \cdot \phi(y) = \sum_i \phi(l_i) \phi(l_i)$$ that is $-1$ is a sum of squares in $\mathbb{Q}$, contradiction.

Note that we do not need to use the existence of a Hamel basis of $\mathbb{R}$ over $\mathbb{Q}$, we could as well work with the $\mathbb{Q}$ span of $x$, $y$ and all of the $l_i$'s.