# How to get center coordinates of circles on edge bigger circle?

I want to draw 8 smaller circles on the edge of a big circle. I know the distance between all small circles should be 20. How can I find the center coordinates of the circles? I already know the center coordinates of the first small circle.

What I know:

• Center coordinates of big circle is (100,100)
• Big circle radius is 200
• There are 8 small circles
• Distance between edges of small circles is 20
• Center coorindates of first small circle
• Size of all small circles is equal

What I want to know:

• Center coordinates of small circles

Sketch problem:

• What are the center coordinates of the first small circle? That would help explain what you mean by the small circles being "on the edge" of the larger circle. – David K Oct 30 '16 at 12:28
• At this moment it's random. But you can make it static if you want. It's not important for my application. I just need 8 circles with same distance between them.. phi = Math.random() * 2 * Math.PI; x = xBigCircle + Math.round(200 * Math.cos(phi)); y = yBigCircle + Math.round(200 * Math.sin(phi)); – Engo Oct 30 '16 at 12:30
• OK, so by "on the edge" you mean the center of each small circle is a point on the big circle. – David K Oct 30 '16 at 12:33
• Yes, that's right! – Engo Oct 30 '16 at 12:34

You already have a formula for finding the center of one of the small circles:

x = xBigCircle + Math.round(200 * Math.cos(phi));
y = yBigCircle + Math.round(200 * Math.sin(phi));


Since you want the small circles all to be the same size and each one is the same distance from each of its neighbors, they will be evenly spaced around the circle. Since one full turn around the circle is the angle 2 * Math.PI, you want one eighth of that, which is 0.25 * Math.PI. Stepping by that angle around the circle eight times, starting at the first circle, gets you back to the first circle while finding seven other equally-spaced points.

The centers of the small circles should be at

x = xBigCircle + Math.round(200 * Math.cos(phi + n * 0.25 * Math.PI));
y = yBigCircle + Math.round(200 * Math.sin(phi + n * 0.25 * Math.PI));


where n ranges from $0$ through $7$, inclusive ($0 \leq n < 8$). The value $n=0$ is just the center of the first small circle, which you already know.

To make a "gap" of size $20$ between each pair of small circles, just set the radius of the small circles accordingly. The distance between centers is 200 * 2 * Math.sin(Math.PI/8), subtract $20$ from that for the desired gap, then divide by $2$ to get the desired radius.

• I found your answer the most helpful because your explanation is based on the center coordinates of the first small circle. Thank you, I really appreciate it! – Engo Oct 30 '16 at 15:31

Regardless of the radii of the smaller circles, this is essentially drawing a regular octagon in the big circle. The vertices of the octagon lie on the big circle and represent the centres of the small circles.

From here, trigonometry or coordinate geometry will finish the job.

I'm adding the sketch of another answer which looks quite elegant to me, based on the above.

Consider the $8$th roots of unity in the complex plane, that is, $e^{\frac{\pi}{4}i}, e^{\frac{\pi}{2}i}, e^{\frac{3\pi}{4}i}, e^{\pi i}, e^{0}, e^{-\frac{\pi}{4}i}, e^{-\frac{\pi}{2}i}, e^{-\frac{3\pi}{4}i}$. These lie on the unit circle centred at zero.

Now, we can easily scale them to the unit circle of radius $200$ by multiplying them all by 200, and converting them to cartesian form using $z = r\cos\theta + ir\sin\theta$. Then the real part is your $x$-coordinate and the imaginary part is the $y$-coordinate. The rest is rotation (changing $\theta$) or translation.

• i.imgur.com/veJvyvc.png Thank you for mentioning the octagon, I never thought about it. I know how to get the length of B and the angle between B and C, but how can I get the coordinates of circle 3? I am not very good in theoretical explanation :) – Engo Oct 30 '16 at 12:48
• I'll use my second answer, since it makes more intuitive sense for me. For example circle 3 we have (using the complex plane method) $200e^{\frac{1}{4}\pi i}$. This is the complex number $100\sqrt{2} - 100\sqrt{2}i$, which lies on the circle of radius $200$ on the complex plane, centred at $0$. To translate this to your circle we just add 100 to both coordinates, so the coordinates of circle 3 is $(100(\sqrt{2}+1), 100(\sqrt{2}-1))$. – Camille Oct 30 '16 at 12:54
• To do it by the octagon method, draw a foot of perpendicular from the centre of circle 3 (bottom vertex of your orange triangle) to the horizontal base. You know the angle at the centre of the big circle - $45^\circ$. Then you have a right-angled triangle which you can use to compute the horizontal and vertical distances from the centre of the big circle by trigonometry (you should get $100\sqrt{2}$ and $-100\sqrt{2}$, where the $-$ sign represents the point lying below the centre of the big circle. Add 100 to both distances (to account for the coordinates of the centre of the big circle). – Camille Oct 30 '16 at 12:58
• I made a mistake in my first comment - the coordinates should be $((100(1+\sqrt{2}), 100(1-\sqrt{2}))$. Oops! Sorry about that! – Camille Oct 30 '16 at 13:04
• Thank you for your explanation, it helped me a lot! – Engo Oct 30 '16 at 15:29

Center coordinates of all small circles are:

• What are the radii of the small circles? – Engo Oct 30 '16 at 14:42
• @Engo, you didn't ask for the radii, did you? The coordinates are as I have shown in that picture. – Seyed Oct 30 '16 at 14:53
• I didnt ask for radii, but I asked for 20 distance between each small circle. Is this requirement included in your answer? – Engo Oct 30 '16 at 14:57
• @Engo, In a question you may provide many different information but at the end of your question you have written: What I want to know: Center coordinates of small circles – Seyed Oct 30 '16 at 14:59
• @Engo, As long as the small circles are equal then no matter what their radius is, the coordinates will be the same. – Seyed Oct 30 '16 at 15:06

Hint: The distance of 20 will generate a isosceles triangle with the leg = R = 200.

Use $\sin(\alpha/2)=(20/2)/200$ to calculate alpha of the distance. How many distances do you have? It should be eight. Now the angle of all distances between the circles is $8\alpha$. From this you can calculate the angle of the circles $\beta$ by $8\beta=360-8\alpha$. Can you complete it from here?

If you know the angle for each circle the thing is pretty easy to calculate you need to find out the angle of the center of the circle and then use the definition of $\sin(x)$ and $\cos(x)$ to calculate the $x$ and $y$ coordinates of the centers.

• The distance $20$ is just the portion of the base of the isoceles triangle between the points where it intersects the small circles. The length of the base is $2r+20$ where $r$ is the radius of a small circle. – David K Oct 30 '16 at 12:35
• @DavidK: Sorry, but I don't get what you are saying. I understood the 20 as the straight distance of two point on the circle. I calculated the associated angle with this between circle distance and used it to derive the angle of the circles on the parameter $\beta$. From this point everything is pretty straight forward. – MrYouMath Oct 30 '16 at 12:48
• Look at where the distance $20$ is marked on the figure. Also keep in mind OP has said the center of each small circle must be on the circumference of the large circle. – David K Oct 30 '16 at 12:51