Drawing a circle tangent to a given circle and its origin is on y-axis I am facing a problem and I do not know if it is solvable or not.
Suppose I have 2 points and a distance, $P_1$, $P_2$ and $D_x$ respectively.
I need a mathematical way to find the center of a circle $\mathcal{C}_1$ that satisfies the following:


*

*The center of $\mathcal{C}_1$ is on the y-axis

*$P_1$ is on the circumference $\mathcal{C}_1$

*$\mathcal{C}_1$ is tangent to circle $\mathcal{C}_2$, where $\mathcal{C}_2$'s center is $P_2$ and its radius is $D_x$.


I tried a lot to find it but I could not.
 A: If $\mathcal C_1$ with radius $r$ is tangent to $\mathcal C_2$, then $\mathcal C_1$ is at distance $|r\pm D_x|$ from $P_2$. Thus we can rephrase the problem as finding a point on the $y$ axis at distance $r$ from $P_1$ and $|r\pm D_x|$ from $P_2$. Let $(x_1,y_1)$, $(x_2,y_2)$ and $(0,y)$ denote the coordinates of $P_1$, $P_2$ and the centre of $\mathcal C_1$, respectively. Then
$$
\begin{align}
x_1^2+(y-y_1)^2&=r^2\;,\\
x_2^2+(y-y_2)^2&=(r\pm D_x)^2\;.
\end{align}
$$
Subtracting the two equations yields a linear relationship between $y$ and $r$:
$$
x_2^2+y_2^2-(x_1^2+y_1^2)+2y(y_1-y_2)=D_x^2\pm2D_xr\;.
$$
For given $y$, exactly one of the solutions for $r$ is non-negative. Solving for $r$ and substituting into the first equation yields
$$
4D_x^2\left(x_1^2+(y-y_1)^2\right)=\left(x_2^2+y_2^2-(x_1^2+y_1^2)+2y(y_1-y_2)-D_x^2\right)^2\;.
$$
According to Wolfram|Alpha, the discriminant of this quadratic equation in $y$ has three roots with respect to $D_x^2$. The one at $D_x^2=0$ is clear: If the circle degenerates to a point, the two solutions coalesce. The other two roots have a nice interpretation. Here $D_x$ is the distance from $P_2$ to $P_1$ and to the reflection of $P_1$ in the $y$ axis, respectively. Any circle with centre on the $y$ axis that goes through $P_1$ also goes through the reflection of $P_1$ in the $y$ axis. If one of these two points is inside $\mathcal C_2$ and the other is outside, a circle through both of them necessarily intersects $\mathcal C_2$, so in this case the problem has no solution. There are two solutions if $P_1$ and its reflection in the $y$ axis either both lie inside or both lie outside $\mathcal C_2$. If one of them lies exactly on $\mathcal C_2$, there is one solution, with the point of tangency coinciding with the point that lies on $\mathcal C_2$, and the centre of $\mathcal C_1$ given by the intersection of the $y$ axis with the line containing the radius of $\mathcal C_2$ through that point.
