# Form a Circle with Circles

I need to form a perfect circle out of circles.

Given N number of circles each with radius R, how can I find the distance away from the center?

-
from which center? – dato datuashvili Apr 11 '13 at 18:02
or how are located centers to each other?are they intersect?or are they touch on one point?or – dato datuashvili Apr 11 '13 at 18:03
So imagine you have N number of balls and you need to arrange them so that they are touching and form a perfect circle. That perfect circle has a center. I want to find the distance from the balls to the center – K2xL Apr 11 '13 at 18:05
for joke perfect circle is this en.wikipedia.org/wiki/A_Perfect_Circle :D,but for mathematic language,what does mean perfect circle/ – dato datuashvili Apr 11 '13 at 18:07
The way to arrange touching circles is in a hexagon (6 circles touching a center one and two other neighbors each). If they don't need to be the same size, almost anything goes... – vonbrand Apr 11 '13 at 18:21

Sorry, this is too brief, there should be a picture. Let the little circles all have radius $r$. Suppose there are $n$ of them, where $n\ge 3$. Let $R$ be the distance from the centre of the big circle to the centre of each little circle. It turns out that $$R\sin\left(\frac{180^\circ}{n}\right)=r,\tag{1}$$ so now we can compute $R$.

To see that Formula $(1)$ is correct, draw two consecutive little circles, with centres $A$ and $B$ respectively. Let the big circle have centre $O$. By the definition of $R$, the big circle passes through $A$ and $B$. Drop a perpendicular from $O$ to the midpoint $M$ of $AB$. The two little circles touch at $M$.

Note that $\angle AOM$ is $\dfrac{180^\circ}{n}$ and $AM=r$. The formula now follows by trigonometry.

The question specifically asked not for $R$, but for the (nearest) distance from the centre of the big circle to the little circles. This is $R-r$.

Remark: I should have called the radius of the little circles $R$, to use the notation of the OP. But it is a little circle, so it should be $r$. Then one can reserve $R$ for the big one.

-
Hmm, I just tried implementing this into a cluster algorithm... But as n increases r (little) is decreasing for me... Shouldn't it be the other way around? – K2xL Apr 11 '13 at 21:09
@K2xL: If $n$ increases, then for fixed $R$ the number $r$ should decrease. – André Nicolas Apr 11 '13 at 22:45
I'm confused... Maybe about the r's. If I have 100 perfect circles with radius 1, the distance to center will have to be bigger than 50 circles of radius 1. – K2xL Apr 12 '13 at 20:31
If you send me the numerical result of a computation that you did, for explicit $r$ and $n$, I can check what's happening. Calculation need not be sent, just the answer. – André Nicolas Apr 12 '13 at 20:51
Posted code and outputs: gist.github.com/k2xl/5383208 (in actionscript) – K2xL Apr 14 '13 at 16:02