# Check if a circle is within an ellipse

I have an ellipse centered at $(h,k)$, with semi-major axis $r_x$, semi-minor axis $r_y$, both aligned with the Cartesian plane.

How do I determine if a circle with center $(x,y)$ and radius $r$ is within the area bounded by the ellipse

• Evaluating inequalities: a point $\;(a,b)\;$ withing the circle (i.e., the disk) fulfills $\;(a-x)^2+(b-y)^2\le r^2\;$ ...now, you have to check if this is within the ellipse. It's hard to say anything more in such a general case. – DonAntonio Feb 8 '18 at 10:06
• The inside of ellipse is where $\left({x-h\over r_x}\right)^2+\left({y-k\over r_y}\right)^2$ is less than 1. Now write the parametric equation for your circle, maximize the said function over it, and check the maximum. If it is under 1, then you are inside. – Ivan Neretin Feb 8 '18 at 10:29
• @Ng Chung Please do not edit the question as to render comments/answers that have already been given hard to understand. – DonAntonio Feb 8 '18 at 10:30
• @DonAntonio, Fine, but at least keep the Latex format and also correct the bugs for major and minor axes, they were the same! Otherwise, just simply roll back. – Ng Chung Tak Feb 8 '18 at 10:38
• @Ricardo, what've you tried and where did you get stucked? Please show your own efforts. – Ng Chung Tak Feb 8 '18 at 10:41

Idea: doing a translation we can suppose than the circle is centered at $(0,0)$. Parametrize the equation of the ellipse:

$$x(t) = h + r_x\cos t,$$ $$y(t) = k + r_y\sin t.$$ And find the maximum and minimum of $t\mapsto x(t)^2 + y(t)^2$.

Solve for $x$ or $y$ from

$$\frac{(x-h)^2}{r_x^2}+\frac{(y-k)^2}{r_y^2}=1$$

and

$$\frac{(x-h)^2}{r^2}+\frac{(y-k)^2}{r^2}=1 .$$

If the point of intersection is complex due to quantity under radical sign (discriminant) being negative, then the circle is inside the ellipse.

If it is zero, the circle touches the ellipse and if posive there is intersection between them at 2 or 4 points.

• Do we have a Simple way to check this? i tried to Solve the equation, but it get a kinda big. – Ricardo Gonçalves Molinari Feb 10 '18 at 22:12
• Groebner basis solution may be helpful when equations are not linear – Narasimham Feb 11 '18 at 17:09