# Area enclosed by robot walk

In a previous question I described $n$-robot walks and $(i,j)$-paths:

A [$5$-]robot moves in a series of one-fifth circular arcs (72°), with a free choice of a clockwise or an anticlockwise arc for each step, but no turning on the spot.

Let an $n$-robot be a robot that moves in $1/n$ of a circular arc.

Let an $(i, j)$-path be a path that consists of $i$ clockwise steps, followed by $j$ anticlockwise steps, followed by $i$ clockwise steps, and so on.

I'm interested in computing the area enclosed by such paths, when the circular arc has radius $1$.

I know how to compute very few special cases.

In particular, (if I have done my calculations correctly) the area enclosed by the $(1,2)$-path of the $4$-robot is $16 + \pi$, and the area enclosed by the $(1,3)$-path of the $4$-robot is $12\pi + 3$.

For example, the picture above illustrates the $(1, 2)$-path, $(1, 3)$-path, $(1, 4)$-path, $(2, 3)$-path, $(2, 4)$-path, and $(3, 4)$-path of a $5$-robot.

How does one compute the area enclosed by any of the above paths? Or even better, how does one compute the area enclosed by an arbitrary $(i,j)$-path for an $n$-robot?

• At least in the non-self-intersecting cases, you can draw a circle through the "inflection points" where clockwise turns to counterclockwise or vice-versa. From there, it's just a matter of determining how much area to add for each lunar hill, and how much to remove for each lunar valley. (In the self-intersecting cases, "area enclosed" may not be properly defined.) – Blue May 7 '18 at 19:26
• @Blue, I agree in principle, but I don't know how to compute this in practice. – Peter Kagey May 7 '18 at 20:03

A partial answer, just to start. For your $(1, 2)$-path of a $5$-robot the area is $$10\,T_5+5\,C_5,$$ where $T_5$ is the area of an isosceles triangle with two sides of length two and the angle between them of $360°/5$, while $C_5$ is $1/5$ the area of a circle of unit radius.

For a $(1, 3)$-path the pattern is similar, but it is not clear how you want to compute the overlapping region.

Here's an initial pass that ignores possible complications in the various parameters.

Let the arcs have radius $r$ and angle $2\theta$, where $\theta := \pi/n$. Joining the centers of the arcs creates an cyclic equilateral $2p$-gon (for some $p$) of edge-length $2r$. (The midpoints of the edges are the "inflection points" in the path, where clockwise arcs meet counter-clockwise arc.) The $2p$-gon alternates interior angles $2i\theta$ and exterior angles $2j\theta$. Joining the vertices of the $2p$-gon to its center creates $2p$ congruent triangles, one of which is marked $\triangle AOB$ in the figure.

The area of the path interior is the area of the $2p$-gon, plus the area contributed by sectors bounded by the "$j$" arcs, minus the area contributed by sectors bounded by the "$i$" arcs.

$$2p\;|\triangle AOB| \;+\; p\cdot\frac12r^2\cdot 2j\theta \;-\; p\cdot\frac12 r^2\cdot 2i\theta \;=\; 2p\;|\triangle AOB| \;+\; pr^2(j-i)\theta \tag{\star}$$

The angles at $A$ and $B$ are half the polygon's interior angles: $\angle A = i\theta$ and $\angle B =(n-j)\theta$. Thus, $\angle O = \pi - \angle A - \angle B = (j-i)\theta$. We see, then, that the number of triangles (ie, the number of sides of the polygon) is $2p = 2\pi/\angle O$, so that $p = n/(j-i)$. (Since $p$ must be a positive integer, we're evidently assuming that $j-i$ is positive, and that it divides $n$.) Thus, $(\star)$ becomes

$$\frac{2n}{j-i}\;|\triangle AOB| \;+\; \pi r^2 \tag{\star\star}$$

Let's turn to that triangle. By the Law of Sines, $$\frac{2r}{\sin(j-i)\theta} = \frac{|OA|}{\sin(n-j)\theta} = \frac{|OB|}{\sin i\theta}$$ Thus, \begin{align}|\triangle AOB| &= \frac12|OA||OB|\sin\angle O \\[4pt] &=\frac12\cdot \frac{2r \sin(n-j)\theta}{\sin(j-i)\theta} \cdot \frac{2r \sin i\theta}{\sin(j-i)\theta}\;\sin(j-i)\theta \\[4pt] &=2r^2\;\frac{\sin i\theta \sin(n-j)\theta}{\sin(j-i)\theta} \end{align} and the area enclosed by the robot path is (maybe)

$$\pi r^2 + \frac{4nr^2}{j-i}\;\frac{\sin \dfrac{\pi}{n} i\; \sin\dfrac{\pi}{n}(n-j)}{\sin\dfrac{\pi}{n}(j-i)} \tag{\star\star\star}$$

The interesting part seems to be that the net contribution of the sectors is independent of $i$, $j$, and $n$. That it's specifically the area of one complete circle suggests that a "winding number" component lurks somewhere. Perhaps there's an elegant way to parameterize the path and invoke Green's Theorem. $\square$