# Circle Touching another circle and a line.

I have tough question, which I need for a program I am working on.

I have one circle where I know its center position $(x,y)$ and radius, and one straight line with the formula $y=x+b$ where $b$ is known.

Now I need to find out the center position of another circle so that it touches both the line and the first circle. For this second circle I know only the radius.

Known
Circle 1: Radius $r_1,C_1(x_1,y_1)$
Circle 2: Radius $r_2$
Line: $ly=lx+b$ ($b$ is a known lenght)

What I need to find is $C_2(x_2,y_2)$

At a later point I will also need to find the centerpoint of a circle touching $2$ known circles, but I hope the answer to the first part will help in this as well.

• The solution is not unique. In fact, once $r_2$ gets large enough, there will be four such circles—the first circle will be internally tangent to two of them. – amd Oct 14 '16 at 18:52

Suppose the center of Circle 1 is $O_1$ and center of Circle 2 is $O_2$. Consider the distances from $O_1$ to $l$ and from $O_1$ to $O_2$.
• Its incredible helpfull in that it has changed my way of thinking about the problem, but i am still stuck. Im not sure how i can use the formulae of distance here. As i see it i have a point $O_1$, the distance to $O_2$ ($r_1+r_2$), the distance between $O_2$ and $l$ ($r2$), and the formula for $l$. – Black Draco Oct 14 '16 at 14:18
• You appear to have misunderstood the problem. As long as $r_2$ is large enough, you can always position the second circle so that it’s tangent to both the line and first circle. – amd Oct 14 '16 at 18:14