Maths question related to circle packing

If you’re expecting this to be an advanced maths question, you’ll be disappointed. It’s almost certainly simple trigonometry, I just seem to be having brain freeze.

Start with a circle with radius R, we’ll call this circle Parent.
Given a number N, make a ring of N circles (Children) on the inner edge of Parent, such that all these circles touch the edge of Parent and touch their (two) neighbouring Children. What is the radius, r, of the Children?

If N = 1, then we can just fill all of parent, so r = R.
If N = 2, then we can have two circles side by side, so r = R / 2.
Does the pattern hold? At N = 3 (3 circles arranged in a triangle), are the Children’s radii R / 3?

You’re basically describing (beyond n=2) an n-gon of sides 2r and if you extent the line from the center of the construct through each subcircle’s center point (center to sub-center distance A), the exterior point describe a congruent n-gon of center-lines A+r=R circumscribed by a circle of radius R.

Where two subcircles touch, a line from that point touch point to the center of the n-gon forms a right triangle with A (going n-gon center to subcircle center) and the radius r, with other angle Θ=(360/2n)° at the center of the n-gon where the opposite is r so hypotenuse is A=(sinΘ)/r

R= A+r = r+ sinΘ/r

Not exactly trivial?

Of course, it’s been over 40 years since I’ve had to do trig so I may be way off…

for 3 circles, the 60° triangle is 1,√3, and 2 so A=2r and R=3r
For 4 circles, the 45° triangle is 1,1,√2 so A=(1+√2)r = 2.41r, R=3.41r
Beyond that the triangles are not so neat.

If the radius of the big circle is 1, aren’t the radii of the small circles sin(pi/n) / (1 + sin(pi/n)) ?

Even without much complicated math you can tell that this is false. If N is extremely large the small circles will form a ring that is very close to outer rim. The big circle has a circumfrence of 2pi*R, while the small circles trace out a polygon with perimeter of N*2r. So for very large N r is approximately R/(pi*N).

Thanks, but I think I lost it already at this point. Is this the triangle?

If so, then sin of this angle looks to be opposite / hypotenuse = r / A, which are both unknowns.
I’ve written a sketch in processing and tried different interpretations of your description, but none work so far.

Yes, but A is the hypotenuse. The angle Θ is 360/2n

So A=r/(sin(360/2n)) (I yield to your trig proficiency) and R=A+r = r(1+1/sin(360/2n))

So where n=3 I had the triangle backwards - the angle is 60° and not the short edge, but the long edge is r, (From center to tangent point to next circle)
so the short edge is r/√3 and hypotenuse A=2r/√3

Where n=4 the angle is 45° and A is √2 * r so R=2.414r

for n=5 circles, then, using A=r/sin(36)=1.70r and R=2.70r

And n=6 Θ=30° A=2r R=3r

We leave the rest as an exercise for the reader, as my textbooks used to say…

If you take paper and compass and actually construct, say, 3 circles packed inside a big circle of radius 10.00 cm, you will quickly discover the diameter of the small circles to be 4.64 cm, a ratio of 2.155 (i.e. 1+\frac{2}{\sqrt{3}}), not 1.577. Your factor of 2 disappeared in mid-sentence


And… Stupid errors doing math was why I never excelled in higher math. That and losing negative signs halfway through…

Thanks guys, it’s working now.
Below is the code for a Processing sketch that illustrates the algorithm (press any key to increase the number of child circles). I couldn’t find a site for running processing sketches online. It’s essentially the same thing as Java though.

final float kParentRadius = 200.0; PVector g_circleCenter; int g_children = 1;

void setup()
g_circleCenter = new PVector(width/2, height/2);

void draw()
background(255, 255, 255);
circle(g_circleCenter.x, g_circleCenter.y, kParentRadius * 2.0); // diameter

void drawChildren(int children)
stroke(0, 255, 0);

float omega = TWO_PI / children;
float childRadius = kParentRadius / (1.0 + (1.0 / sin(omega / 2.0)));
float distanceFromParentCenterToChildCenter = kParentRadius - childRadius;
PVector childOffset = new PVector(distanceFromParentCenterToChildCenter, 0.0);

for (int child = 0; child < children; child++)
circle(g_circleCenter.x + childOffset.x, g_circleCenter.y + childOffset.y,
childRadius * 2.0); // diameter

void keyPressed()