[Math] find radius of circle given tangent line, line and tangent circle

circlestangent line

enter image description here

From the image, I need to find radius r.

I have a circle(R) whose center is $(0,0)$ and has a radius $R$.

I need to find radius $r$ of circle(r) which is internal and tangent to the circle $R$.

Circle(r) is also tangent to a vertical line at a distance $a$ from the origin
Circle(r)'s centre is on a horizontal line that is distance $b$ from the vertical

I'm not able to find the answer.

Best Answer

enter image description here

We have $(R-r)^2 = (a-r)^2 +b^2$ and hence $$r = \frac{R^2-a^2-b^2}{2(R-a)}$$