Tuesday, October 30, 2018

Circles Packed in an Ellipse

This animation1 shows four identical circles packed in an ellipse. The circles are tangent to each other and to the ellipse. There are two circles on the x-axis and two on the y-axis. Let \(\theta\) be the angle between the origin, the center of the lower circle, and the center of one of the circles to the left or the right.2 Now let's find the equations of the circles as \(\theta\) varies over time between \(0\) and \(\frac{\pi}{2}\). Assume the radius is \(1\).

\[ \left( x \pm 2\sin\theta \right)^2 + y^2 = 1 \] \[ x^2 + \left( y \pm 2\cos\theta \right)^2 = 1 \]

To find the equation of the ellipse, we need to know the major and minor axes. Finding the major axis is tricky because it sometimes ends on the perimeter of a circle, but sometimes it extends past it. It turns out we actually need three different equations, for when \(\theta\) is in different intervals. The three equations are represented by different colors in the animation.

\begin{align} x^2 + y^2\sin\theta = \left( 1 + 2\sin\theta \right)^2 \qquad & \text{if } \; 0 \leq \theta \leq \alpha \tag{1} \\ \\ \frac{x^2}{\left(1+2\sin\theta\right)^2}+\frac{y^2}{\left(1+2\cos\theta\right)^2}=1 \qquad & \text{if } \; \alpha < \theta \leq \beta \tag{2} \\ \\ x^2\cos\theta+y^2=\left(1+2\cos\theta\right)^2 \qquad & \text{if } \; \beta < \theta \leq \frac{\pi}{2} \tag{3} \\ \\ & \text{where } \alpha \approx 0.355,\; \beta \approx 1.216 \end{align}

The Major Axis

Let's derive equation \((3)\) (the other two aren't any harder). That means \(\theta\) will be near \(\frac{\pi}{2}\). Start with the general equation for an ellipse. The minor axis \(b\) is vertical and it extends from the origin, along the y-axis to the far perimeter of one of the circles, so \(b = 1+2\cos\theta\). To find the major axis \(a\), let's look at the intersections between the ellipse and one of the lateral circles. Solve both equations for \(y^2\) and set them equal to each other.

\begin{equation*} b^2 \left(1 - \frac{x^2}{a^2} \right) = 1 - \left(x + 2\sin\theta \right)^2 \tag{4} \end{equation*}

The blue lines in the image to the right show the values of \(x\) that solve equation \((4)\), for varying values of \(a\) and fixed \(\theta\). Note that some of the solutions are extraneous (when the blue line doesn't intersect the ellipse). We want to choose \(a\) so that the ellipse is tangent to the circle. At that moment, there is exactly one solution for \(x\) (represented as one blue line).3 The equation is quadratic in \(x\), so let's take a look at the discriminant.

\[ D = 16 (1 + \cos\theta) \left( \frac{\left( 1 + 2\cos\theta \right)^2}{a^2} - \cos\theta \right) \]

Setting this to \(0\), we get \(a = \frac{1+2\cos\theta}{\sqrt{\cos\theta}}\).

Bounds

If you don't use the proper bounds \(\alpha\) and \(\beta\), the ellipse will either detach from the circles unnecessarily (as shown), or intersect the circles non-tangentially. I followed a process similar to finding the major axis. I started by looking for intersections between an ellipse equation and one of the circle equations. At the bounds, the number of intersections changes, and I again used the discriminant. This time the only unknown is \(\theta\), and after a lot of simplification, I ended up with a cubic in terms of \(\sin\theta\). Let \(r\) be the real root of \( 4x^3 + 4x^2 + x - 1 \). Then \(\alpha = \sin^{-1} r\) and \(\beta = \cos^{-1} r\).

I thought it was interesting that the different ellipse curves transition smoothly into one another at the bounds, so I graphed their areas as functions of \(\theta\) (in Cartesian coordinates). Not only do they meet at the bounds, but their derivatives are also the same.


1. Created with Desmos.

2. This work was inspired by this problem, which asks for the minimum area of the ellipse.

3. Without the benefit of the animation, how could I conclude that equation \((4)\) should have exactly one solution at the moment of tangency? What if, at that moment, there are two solutions and one of them is extraneous?