# What do you see when you drive past an orchard?

If you've ever driven past an orchard where the trees are planted in a perfect grid, you may have noticed that if you align your line of sight with the grid, you can see down the successive rows and it looks kind of cool.

If the trees are sufficiently thin, you may notice that other directions - such as $45^\circ$ to the axes of the grid - have the same effect, although the gap you're able to view is smaller. If you drive past a grid of thin poles, there are many "resonant directions" that you can see and it looks pretty neat. I can't help but think there's some underlying math here.

Here's the model: you start at $(0, 0)$ and drive down the positive x-axis. At every point with positive integer coordinates, we place a pole. You then turn your head $\theta$ radians to the left of the x-axis. I want to find the function $w(\theta)$ that tells you the width of the gap you see.

Here's an example, that shows that $w(\frac{\pi}{4}) = \frac{1}{\sqrt{2}}$. The only observation I can make is this:

Let $\tan(\theta) = \frac{a}{b}$ for $a, b \in \mathbb{N}$. Let $T$ be the triangle with endpoints at $\{(0,0),(0,a),(b,0)\}$. Then $w(\theta)$ is equal to the shortest distance from the hypotenuse of $T$ to some point $(c, d)$ in $T$ with $c, d \in \mathbb{Z}$. But I am hoping there is a more elegant expression of $w(\theta)$ than that.

Thanks!

First observation: if $\tan\theta\in\mathbb R\setminus\mathbb Q$, i.e. that tangens is an irrational number, then every ray will come arbitrarily close to some pole at some point. So as long as you extend that array of poles to infinity the way you describe it, you will almost never see a real gap which continues to infinity as well.

From this perspective, an approach which assumes the angle to be a rational number the way you did seems kind of natural. I'd also assume that fraction to be fully reduced, i.e.

$$\tan\theta=\frac ab \quad a,b\in\mathbb N \quad \gcd(a,b)=1$$

The idea of the triangle you gave is already a useful tool here. Its interior can be described as

$$x,y\in\mathbb N\quad x,y>0\quad ax+by<ab$$

From all these points you are looking for the one which maximizes $ax+by$. You can in fact drop the positivity constraint: if you find a point close to the line of the hypothenuse, then you will also find a point shifted by an integral multiple of $(-b,a)$ with the same distance.

So how close can you get to that hypothenuse? Since I assumed $\gcd(a,b)=1$, any integer can be described by an integral combination of $a$ and $b$. Suitable $x$ and $y$ can be obtained using the extended Euclidean algorithm. So the closest you can get is $ax+by=ab-1$. To measure the distance, you can use the Hesse normal form for the equation of the hypothenuse. In effect that means you'll have to divide the equation by the length of the vector $(a,b)$. Plug in the minimal difference of $1$ and you obtain the final answer:

$$w = \frac{1}{\sqrt{a^2+b^2}}$$

• That's so damn cool. Thank you!
– GMB
Oct 17, 2013 at 4:23