Here's a a famous problem:

## If a rectangle $R$ is tiled by rectangles $T_i$ each of which has at least one integer side length, then the tiled rectangle $R$ has at least one integer side length.

There are a number of proofs of this result (14 proofs in this particular paper by Stan Wagon). One would think this problem is a tedious exercise in combinatorics, but the broad range of solutions which do not rely on combinatorial methods makes me wonder what deeper principles are at work here. In particular, my question is about the proof using double integrals which I sketch out below:

Suppose the given rectangle $R$ has dimensions $a\times b$ and without loss of generality suppose $R$ has a corner at coordinate $(0,0)$. Notice that $\int_m^n\sin(2\pi x)dx=0$ iff $m\pm n$ is an integer. Thus, for any tile rectangle $T_i$, we have that:

$$\int\int_{T_i}\sin(2\pi x)\sin(2\pi y)dA=0$$

If we sum over all tile rectangles $T_i$, we get that the area integral over $R$ is also zero:

$$\int\int_{R}\sin(2\pi x)\sin(2\pi y)dA=\sum_i\int\int_{T_i}\sin(2\pi x)\sin(2\pi y)dA=0$$

Since the corner of the rectangle is at $(0,0)$, it follows that either $a$ or $b$ must be an integer.

**My question is as follows: where exactly does such a proof come from and how does it generalize to other questions concerning tiling? There is obviously a deeper principle at work here. What exactly is that principle?**

One can pick other functions to integrate over such as $x-[x]-1/2$ and the result will follow. *It just seems like black magic that this works*. It's as if the functions you are integrating over tease out the geometric properties of your shape in an effortless way.

EDIT: It's likely that one doesn't necessary need integrals to think in the same flavor as this solution. You're essentially looking at both side lengths in parallel with linear test functions on individual tiles. However, this doesn't really explain the deeper principles here, in particular how one could generalize this method to more difficult questions by choosing appropriate "test functions."