Calculate radius of variable circles surrounding big circle. I got a circle, which I know all the details about him. (Radius [100], Diameter [200], Circumference [628.32], Area [31415.93]...)
I would like to surround this circle, with smaller circles. I know the amount of the smaller circles (in this case 14, but it can be less > minimum 4). 
I need a formula to calculate the Radius of the smaller circles.
I got the following formula, but this is not right...
R = radius of big circle
n = number of smaller circles
P = tan(360/2n)
r = radius of smaller circles
r = (-(PR))/(P-1)


Here's an example of how it should looks like (this is not right, because I didn't know the Radius of the smaller circles, I just guessed..):

Thank you very much!
 A: If you connect the centers of two adjacent little circles and the center of the big one, you'll get a triangle. The sides of this triangle have lengths $r+R, r+R$ and $2r$. A little trigonometry will get you that the top angle is
$$\theta=2\arcsin\left(\frac{r}{r+R}\right) \; .$$
Since you want the small circles to form a closed ring around the big circle, this angle should enter an integer amount of times in $360°$ (or $2\pi$ if you work in radians). Thus,
$$\theta=360°/n \; .$$
From this, you can compute that
$$r=\frac{R \sin(180°/n)}{1-\sin(180°/n)} \; .$$
Here's a plot of the result for $n=14$:

Here's the code in Scilab:

n=14;
R=1; 
r=R*sin(%pi/n)/(1-sin(%pi/n));
theta=2*%pi*(0:999)/1000;
plot(Rcos(theta),Rsin(theta)); 
hold on; 
for k=0:(n-1),
plot((r+R)*cos(2*k*%pi/n)+r*cos(theta),(r+R)*sin(2*k*%pi/n)+r*sin(theta));
end; 
hold off;

A: You have a bigger circle when you connect the centers of smaller circles. So, you have another radius which is (r + R). After you draw a line between two adjacent little circles, there is a triangle for you to apply cos theorem. 
Long side's length is r+R and short side is 2r. The angle between two long side is 2n, which is the number of smaller circles around the circle.
Therefore, (2r)^2= 2*(r+R)^2 - 2*(r+R)^2cos(2n) will do the trick, I guess.
