I've been trying to figure out how to create an ellipse mathematically given the following with no luck.

The ellipse should be tangent to a given circle with known center(h,k) and radius(r). The ellipse is also tangent to a vertical line at point Q. The center of the ellipse's center will have the same y coordinate as point Q. I am given that a/b=e so I do not know exactly what a or b are of the ellipse. I also know the ellipse will be inside of the given circle and the tangent point will happen in the 1st quadrant of the ellipse somewhere.

The problem I keep running into is the fact I don't know what a or b are, just the ratio.

Some point P is where the ellipse and circle intersect.


  • $\begingroup$ Hint: if $Q=(x_0,y_0)$, then the center of the ellipse would be $(h,y_0)$. $\endgroup$ – Isko10986 Nov 15 '16 at 21:54
  • $\begingroup$ Edit: Misread your response. The ellipse and the circle are not tangent at the peak of the circle $\endgroup$ – United13 Nov 15 '16 at 21:58
  • $\begingroup$ From there, just get the distance of $(h,y_0)$ from Q and from the nearest point on the circle. Those will be your semi-major/minor axes, hence your a/b. $\endgroup$ – Isko10986 Nov 15 '16 at 22:01
  • $\begingroup$ and btw, if $Q$ is inside[outside] the circle, your ellipse is inside[outside] the circle; if $Q$ is on the circle, then your ellipse is the circle. $\endgroup$ – Isko10986 Nov 15 '16 at 22:04
  • $\begingroup$ Q is not on the circle but it also is inside the circle. The point of intersection between the ellipse and the circle is at some other point P. $\endgroup$ – United13 Nov 15 '16 at 22:10

Let's see what we have.

  • The circle is $(X-h)^2+(Y-k)^2=r^2$.
  • The ellipse is $((X-c)/b)^2+((Y-y_Q)/a)^2=1$, i.e. axis-aligned with $b$ as the horizontal semiaxis and $a$ as the vertical semi-axis, and with $y_Q$ as the $y$-coordinate of the center. $c$ is the unknown $x$ coordinate of the center.
  • As $Q$ lies on the ellipse, $((x_Q-c)/b)^2=1$ so $(x_Q-c)^2=b^2$ and $c=x_Q\pm b$.
  • The equation of the ellipse can also be written as a polynomial $$a^2X^2-2a^2cX+a^2c^2+b^2Y^2-2b^2y_QY+b^2y_Q^2-a^2b^2=0$$ or using a matrix and homogeneous coordinates as $$(X,Y,1)\cdot\begin{pmatrix} a^2 & 0 & -a^2c \\ 0 & b^2 & -b^2y_Q \\ -a^2c & -b^2y_Q & a^2c^2+b^2y_Q^2 - a^2b^2 \end{pmatrix}\cdot\begin{pmatrix}X\\Y\\1\end{pmatrix}=0\;.$$ If $P=(x_P,y_P)$ is a point on that conic, then another point $(X,Y)$ lies on the tangent in $P$ if $$(X,Y,1)\cdot\begin{pmatrix} a^2 & 0 & -a^2c \\ 0 & b^2 & -b^2y_Q \\ -a^2c & -b^2y_Q & a^2c^2+b^2y_Q^2 - a^2b^2 \end{pmatrix}\cdot\begin{pmatrix}x_P\\y_P\\1\end{pmatrix}=0\;$$ so that tangent can be written as the equation $$a^2(x_P-c)X + b^2(y_P-y_Q)Y = a^2c(x_P-c)+b^2y_Q(y_P-y_Q)+a^2b^2\;.$$
  • The same can be done for the circle, to obtain the tangent to the circle in point $P$. I'll leave this as an exercise.
  • Here we have two equations of a line, which I'll abbreviate to $\lambda_1X+\mu_1Y=\tau_1$ and $\lambda_2X+\mu_2Y=\tau_2$. If these are to describe the same line, then they have to be multiples of one another. Which means $\lambda_1\tau_2=\lambda_2\tau_1$ and $\mu_1\tau_2=\mu_2\tau_1$. On the other hand, as both of these tangents pass through the same point $P$, it is enough to check that their directions agree, which can be accomplished by $\lambda_1\mu_2=\lambda_2\mu_1$ ignoring the right hand sides.
  • You also have equations saying that $P$ is a point on the ellipse resp. circle. Simply plug $P$ in the corresponding equation. (Without this, the line I called the tangent would only be the polar).

Now you have 5 polynomial equations:

  1. $a=eb$ (known ratio $e$)
  2. $(x_Q-c)^2=b^2$ ($Q$ lies on ellipse)
  3. $(x_P-h)^2+(y_P-k)^2=r^2$ ($P$ lies on circle)
  4. $a^2x_P^2-2a^2cx_P\cdots-a^2b^2=0$ ($P$ lies on ellipse)
  5. $\lambda_1\mu_2=\lambda_2\mu_1$ (same tangent directions)

As I understand your question, these involve 6 known quantities ($h,k,r,x_Q,y_Q,e$) and 5 unknowns ($a,b,c,x_P,y_P$). So I'd say that there is a good chance that the above equations will lead to a few distinct solutions. As many of them look non-linear, I'd not expect a single unique solution, though. One can now use a computer algebra system to enumerate solutions satisfying all of these polynomial equations.

  • 1
    $\begingroup$ Good and thorough work ! A little remark: the OP had no idea of the meaning of $a$, $b$ and $e$, which is a problem, because he has given a formula $a/b=e$; but if $a$, $b$ are interpreted as the half lengths of the axes, $a/b$ cannot be interpreted as the eccentricity (the formula linking $a$ and $b$ and $e$ is $e=c/a=\sqrt{a^2-b^2}/a$). But it is not harmful if we consider that the ratio $a/b$, called $e$, is a constant, without calling it "eccentricity". $\endgroup$ – Jean Marie Nov 20 '16 at 22:00
  • $\begingroup$ @JeanMarie: You are right, thanks for pointing this out. I've modified my answer to avoid calling this eccentricity. In case of actual eccentricity, the polynomial equation in question should read $a^2e^2=a^2-b^2$ as your $c$ is again different from my $c$. $\endgroup$ – MvG Nov 20 '16 at 23:02
  • $\begingroup$ I have written a somewhat simplified solution. I would appreciate to have your checking/opinion on it. $\endgroup$ – Jean Marie Nov 21 '16 at 13:52

The solution of @MvG is general. I propose here a simplified version in order to improve our understanding and thus the degrees of freedom we have.

Let us refer to the figure below. I have considered WLOG that the circle is the unit circle: center in $(0,0)$, radius 1.

I have taken the following conventions, slightly different from the OP and MvG. I call $(x_C,y_0)$ the coordinates of the center of the ellipse; I attribute the names $a$ and $b$ respectively, to the horizontal and vertical semi-major axis lengths, with $\rho$ defined by $$\tag{0}\rho:=\dfrac{a}{b}.$$ ($\rho$ has been taken in replacement of $e$ in order to avoid ambiguities with the classical use of $e$ for eccentricity).

Take note of the relationship:


Let $P$ the point of contact of the circle and the ellipse. If $\theta$ is the polar angle of $P$, its coordinates are $(\cos\theta,\sin\theta)$.

Let us reformulate the problem as follows:

Show that, being fixed $x_0,y_0$ and $x_c$, for each value of $\theta$, there exist an ellipse centered in $C(x_c=x_0-a, y_0)$ with horizontal semi-major axis $CQ$, that is internally tangent to the circle in $P$.

Proof: The equation of the ellipse is (by taking $(0)$ into account): $$\tag{2}\dfrac{(x-x_c)^2}{a^2}+\dfrac{(y-y_0)^2}{b^2}=1 \ \ \ \ \iff \ \ \ \ (x-x_c)^2+\rho^2(y-y_0)^2=\rho^2 b^2.$$

The fact that, at point $P(x,y)=(\cos\theta,\sin\theta)$, the gradient $V=\pmatrix{(x-x_c)\\ \rho^2(y-y_0)}$ of the ellipse is proportional to the gradient of the circle is expressed in the following way:

$$\begin{vmatrix}\cos\theta-x_c&\cos\theta\\ \rho^2(\sin\theta-y_0)&\sin\theta\end{vmatrix}=0 \ \ \iff $$

$$\tag{3}(\cos\theta-x_c)\sin\theta=\rho^2 \cos\theta(\sin\theta-y_0)$$

Besides, we have to express that point $P$ belongs to the ellipse. This gives (using $(2)$) the constraint

$$(\cos\theta-x_c)^2+\rho^2(\sin\theta-y_0)^2=\rho^2 b^2 \ \ \ \ \iff$$

$$\tag{4}(\cos\theta-x_c)^2=\rho^2 (b^2-(\sin\theta-y_0)^2).$$ Eliminating $e^2$ by taking the quotient of (4) by (3), we obtain a relationship where every parameter has a value, giving the following formula for $b$:

$$\tag{5}b^2=(\sin\theta-y_0)^2\left(1+\dfrac{\cos\theta-x_c}{\tan \theta (\sin\theta-y_0)}\right).$$

Thus, knowing $b$, we have the lacking information for building our ellipse.

Remark: One can wonder if the RHS of $(5)$ is always positive. A little analysis shows that this positivity constraint is equivalent to $x_0 \cos \theta+ y_0 \sin \theta \leq 1$ which is true. enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.