# Coordinates of the intersection points between an ellipse and a chord line

Hi could someone help me, I have tried but I got huge and no correct numbers when comparing to work of GeoGebra.

I have an Ellipse $$(E)$$ with semi-axis major and minor $$a$$ and $$b$$ respectively; being $$a>b$$.

And a line $$D$$ of equation $$y=-\frac{\alpha\cdot b^2}{\beta\cdot a^2}\cdot x + \frac{b^2}{\beta}$$

Line $$D$$ is intersecting the ellipse $$E$$ with two points $$B(x_b,y_b)$$ and $$C(x_c,y_c)$$

I would like to find the coordinates of both $$B$$ and $$C$$ , I tried but I failed.

My problem was to find the equations of two tangent lines to this ellipse $$E$$ from an outside point $$P(\alpha,\beta)$$ , I solved for $$x$$ after equating $$y$$ of ellipse and $$y$$ of a general line.

I reached after all that, the equation of this line joining $$B$$ and $$C$$ but not found their coordinates :(

Any help would be appreciated

• So the ellipse is $\dfrac{x^2}{a^2} + \dfrac{y^2}{b^2} = 1$ with $a > b$ and the line is $y = -\dfrac{\alpha b^2}{\beta a^2} x + \dfrac{b^2}{\beta}$? Jun 5, 2017 at 15:38
• Yes, that is my case, I have posted an image now Jun 5, 2017 at 15:46
• Show us your solution so that we can see where you might be going wrong.
– amd
Jun 5, 2017 at 17:36
• I’m guessing that $D$ is the polar line of $P$. It would be better to express it as $\frac\alpha{a^2}x+\frac\beta{b^2}y=1$, otherwise you’ve excluded the entire $y$-axis from possible locations of $P$. Stylistically speaking, using both $a$ and $\alpha$ or $b$ and $\beta$ in the same formulas makes for difficult reading.
– amd
Jun 7, 2017 at 1:23
• @Hamed, thank you very much for your answer and for your edits... that gave me better details, I started recently with my problem, it was by the discriminant of first quadratic equation after equation both y's Jun 7, 2017 at 8:57

This notation of yours is throwing me off... Let $$\mathrm{ellipse}(E): \frac{x^2}{a^2}+\frac{y^2}{b^2}=1, \quad \mathrm{line}(D): y=-Ax+B$$ I'm not going to assume anything and let $A,B$ be arbitrary. So basically you need to solve $$0=\frac{x^2}{a^2}+\frac{(-Ax+B)^2}{b^2}-1\Longrightarrow\left[b^2+(Aa)^2\right]x^2 - 2[ABa^2]x + \left[a^2(B^2-b^2)\right]$$ which has the solutions (I denote the solutions by capital letters) $$X_{\pm} =\frac{ABa^2\pm a\sqrt{\left(ABa\right)^2- \left[B^2-b^2\right]\left[b^2+(Aa)^2\right]}}{b^2+(Aa)^2}= \frac{ABa^2\pm ab\sqrt{b^2+(Aa)^2- B^2}}{b^2+(Aa)^2}$$ From what I understand from your question, there are two intersection points. This means that $b^2+(Aa)^2- B^2>0$. The coordinates of the two intersection points are then $$\boxed{ (X_{\pm}, Y_{\pm})=\left(\frac{ABa^2\pm ab\sqrt{b^2+(Aa)^2- B^2}}{b^2+(Aa)^2}, \: \frac{Bb^2\mp (Aa)b\sqrt{b^2+(Aa)^2- B^2}}{b^2+(Aa)^2}\right)}$$ Again if I understand it correctly you're putting $A=\alpha b^2/\beta a^2, B=b^2/\beta$.

Edit: If you are looking for the coordinates of the two points at which tangents lines from an outside point $(\alpha, \beta)$ meet the ellipse, you can do it as follows: A line passing through $(\alpha, \beta)$ is of the form $y=-Ax+(A\alpha+\beta)$ with $A$ arbitrary at this point.

[Edit 2: There is another possibility of having a vertical tangent line. The equation $y=-Ax+(A\alpha+\beta)$ does not capture that. This however only happens when $\alpha = \pm a$. I'll study this special case always in brackets in the following.]

Assuming $\alpha^2\neq a^2$ Intersecting with the ellipse, you need to solve a similar equation as what I did above with $B=A\alpha+\beta$. The discriminant of the quadratic equation (the quantity under the square root), as I mentioned above is $$\Delta := b^2+(Aa)^2- B^2=b^2+(Aa)^2- (A\alpha+\beta)^2=(a^2-\alpha^2)A^2-2(\alpha\beta) A + (b^2-\beta^2)$$ Now if this line is tangent to the ellipse, this means $\Delta=0$ (sine there is only one solution). This, in turn, means you need to solve $$(a^2-\alpha^2)A^2-2(\alpha\beta) A + (b^2-\beta^2)=0\Longrightarrow A_{\pm}=\frac{\alpha\beta \pm \sqrt{(\alpha\beta)^2-(a^2-\alpha^2)(b^2-\beta^2)}}{a^2-\alpha^2}$$ So the equations for the tangent lines are $y=-A_{\pm}x+(A_{\pm}\alpha+\beta)$. Using the equation in the box above once more, you then find the coordinates of these two points: Since $\Delta=0$, the points are

$$(X_1, Y_1)=\left(\frac{A_+(A_+\alpha+\beta)}{b^2+(A_+a)^2},\frac{(A_+\alpha+\beta)b^2}{b^2+(A_+a)^2}\right), (X_2, Y_2)=\left(\frac{A_-(A_-\alpha+\beta)}{b^2+(A_-a)^2},\frac{(A_-\alpha+\beta)b^2}{b^2+(A_-a)^2}\right)$$

[In case $\alpha=\pm a$, one tangent line is definitely $x=\alpha$. In this case, one of your intersection points is $(\alpha,0)$. The other tangent line is definitely NOT vertical, however. Going back to the equation $(a^2-\alpha^2)A^2-2(\alpha\beta) A + (b^2-\beta^2)=0$, since $a^2=\alpha^2$, we find the (negative of the) slope of the other tangent line is $A=(b^2-\beta^2)/(2\alpha\beta)$. Now use the equation in the box to obtain the coordinates of the other intersection point.]

• The equation $y=-Ax+(A\alpha+\beta)$ omits the vertical line through $(\alpha,\beta)$, which could well be tangent to the ellipse—the denominator of your solution for $A_\pm$ becomes zero for that line.
– amd
Jun 5, 2017 at 19:23
• You're right I'll add this. Jun 5, 2017 at 19:30
• Instead of treating is as a special case, wouldn’t it be better to start off with a different form of equation for a line that covers all cases in the first place? (The OPs equation for the line omits the entire $y$-axis as possible points $P$, so we started off on the wrong foot.)
– amd
Jun 7, 2017 at 1:26
• I could have done that, but then I wanted to use what I had found in the first part of the answer. Jun 7, 2017 at 14:58

Hamed’s answer covers your specific question in great detail, but I’d like to suggest a couple of different approaches to the problem you were trying to solve that led to it that might make the algebra easier.

Every ellipse can be obtained from the unit circle via an affine transformation, which preserves its tangents. So, start by solving the simpler problem of finding tangents to the unit circle. For the point $P(d,0)$, $d\ge1$, this is particularly simple. Its polar line is $x=1/d$, which intersects the unit circle at $y=\pm\sqrt{1-1/d^2}$. For a general point $(\xi',\eta')$ that is not interior to the circle, set $d=\sqrt{\xi'^2+\eta'^2}$, the distance of the point from the origin, and rotate the two intersection points derived previously for the simple case into place, producing the points $$\frac1{d^2} \left(\xi'\pm\eta'\sqrt{d^2-1},\eta'\mp\xi'\sqrt{d^2-1}\right).\tag1$$ Using the point/normal form of equation for a line and expanding $d^2$, these points give us the equations $$\left(\xi'\pm\eta'\sqrt{\xi'^2+\eta'^2-1}\right)\,x'+\left(\eta'\mp\xi'\sqrt{\xi'^2+\eta'^2-1}\right)\,y'=\xi'^2+\eta'^2\tag2$$ for the tangent lines to the unit circle.

For an ellipse in standard position with semi-axis lengths $a$ and $b$ and point $P(\xi,\eta)$, transform into the simple case, solve it, and transform back. The transformation to the unit circle is a simple scaling: $\xi'=\xi/a$ and $\eta'=\eta/b$. The transformation back can be accomplished by replacing $x'$ by $x/a$ and $y'$ by $y/b$. Making these substitutions into equation (2) rearranging and multiplying through by $ab$ results in the equations $$b^2\xi(x-\xi)+a^2\eta(y-\eta)\pm(\eta x-\xi y)\sqrt{b^2\xi^2+a^2\eta^2-a^2b^2}=0\tag3$$ for an ellipse in standard position.

Another way to go is to use the dual conic to the ellipse. First, translate the origin to $P(\xi,\eta)$. The matrix of the ellipse in this coordinate system is $$Q=\begin{bmatrix}\frac1{a^2} & 0 & \frac\xi{a^2} \\ 0 & \frac1{b^2} & \frac\eta{b^2} \\ \frac\xi{a^2} & \frac\eta{b^2} & {\xi^2\over a^2}+{\eta^2\over b^2}-1\end{bmatrix}$$ and the matrix of its dual is $$Q^{-1}=\begin{bmatrix}a^2-\xi^2 & -\xi\eta & \xi \\ -\xi\eta & b^2-\eta^2 & \eta \\ \xi & \eta & -1 \end{bmatrix}.$$ The tangents we’re interested in pass through the origin, so will have the homogeneous representation $[\lambda,\mu,0]$, which is equivalent to zeroing out the last row and column of the above dual matrix. To get the equation of the two lines, we invert the upper-right $2\times2$ submatrix. Since we’re working in homogeneous coordinates, any nonzero scalar multiple of this matrix is equivalent, so we use the adjugate instead to make this computation trivial, resulting in the matrix $$T=\begin{bmatrix} b^2-\eta^2 & \xi\eta & 0 \\ \xi\eta & a^2-\xi^2 & 0 \\ 0&0&0 \end{bmatrix}$$ for the degenerate conic that consists of the tangents to the ellipse through the origin. Finally, translate $P$ back to where it started, yielding as an equation of the tangent lines through $P$ $$(b^2-\eta^2)(x-\xi)^2 + 2\xi\eta(x-\xi)(y-\eta) + (a^2-\xi^2)(y-\eta)^2 = 0$$ which simplifies to $$b^2(x-\xi)^2+a^2(y-\eta)^2-(\eta x-\xi y)^2=0.\tag4$$ (If you multiply the two equations in (3) together and factor, you’ll get equation (4) times a positive constant.)

If you need the individual equations, you can painstakingly factor equation (4), cheat and use equation (3), or go back to the dual and solve $[\lambda,\mu,0]Q^{-1}[\lambda,\mu,0]^T=0$ for $\lambda$ and $\mu$: $$(a^2-\xi^2)\lambda^2 - 2\xi\eta\lambda\mu + (b^2-\eta^2)\mu^2 = 0$$ which yields as one possible solution the lines $$\left[b^2-\eta^2,\xi\eta\pm\sqrt{b^2\xi^2+a^2\eta^2-a^2b^2},0\right]\tag5$$ in homogeneous form, or $$(b^2-\eta^2)\,x+\left(\xi\eta\pm\sqrt{b^2\xi^2+a^2\eta^2-a^2b^2}\right)\,y=0$$ in Cartesian, which after translation becomes $$(b^2-\eta^2)(x-\xi)+\left(\xi\eta\pm\sqrt{b^2\xi^2+a^2\eta^2-a^2b^2}\right)(y-\eta)=0.\tag6$$ Unfortunately, this last equation gives only one of the tangent lines when $\eta=\pm b$, which will have to be handled as a fairly straightforward special case that I’ll leave to you. Equation (4), on the other hand, is correct in all cases. This method generalizes to higher dimensions, allowing the tangent cone to an ellipsoid to be found the same way, for instance.

Additional method: In this answer, MvG describes a method to find the intersection of a line and conic that involves decomposing a rank 2 matrix into its two generating vectors. Since this intersection problem is the dual of the original problem you were trying to solve, that of finding the tangents to an ellipse through a given point, the same method can be used to find the solution to that original problem directly.

This time we’ll leave the origin at the center of the ellipse. Its matrix is then simply $C=\operatorname{diag}(1/a^2,1/b^2,-1)$. The matrix $P_\times^TC^{-1}P_\times$, where $P_\times$ is the “cross-product matrix” for the point $P$, is a degenerate conic that consists of the two tangent lines through $P$: If the point $X$ lies on this conic, then $$X^TP_\times^TC^{-1}P_\times X=(P\times X)^TC^{-1}(P\times X)=0$$ which means that the line $P\times X$ through $X$ and $P$ is tangent to the ellipse.

For $P(\xi,\eta)$ we have $$P_\times=\begin{bmatrix}0&-1&\eta\\1&0&-\xi\\-\eta&\xi&0\end{bmatrix}$$ and $C^{-1}$ is trivial to compute, so for the tangent lines we end up with the matrix $$M=\begin{bmatrix}b^2-\eta^2 & \xi\eta & -b^2\xi \\\xi\eta & a^2-\xi^2 & -a^2\eta \\ -b^2\xi & -a^2\eta & a^2\eta^2+b^2\xi^2 \end{bmatrix}.$$ (Observe that this is the matrix $T$ above translated by $-(b^2\xi,a^2\eta)$. Observe also that $T=O_\times^TQ^{-1}O_\times$, where $O$ is the origin. If you examine $O_\times$, you’ll see why we could use the adjugate of the upper-left submatrix in that computation.) It’s fairly easy to verify that the null vector of this matrix is the point of intersection, $P(\xi,\eta)$.

At this point we can say that we’re done since we’ve got an equation for the two lines—$\mathbf x^TM\mathbf x=0$—but we’ll continue and decompose $M$ into its constituent lines $\mathbf l$ and $\mathbf m$. $M$ is a multiple of $\mathbf l\mathbf m^T+\mathbf m\mathbf l^T$, so following the method described in the linked answer, we form $M+\lambda P_\times$, set some $2\times2$ minor to zero and solve for $\lambda$. The upper-left minor looks like the simplest to work with, so we have $$(a^2-\xi^2)(b^2-\eta^2)-(\xi^2\eta^2-\lambda^2)=0$$ from which $$\lambda=\pm\sqrt{b^2\xi^2+a^2\eta^2-a^2b^2}.$$ We’ll use the positive root and then take for $\mathbf l$ and $\mathbf m$ any convenient row and column of $M+\lambda P_\times$, yielding the two lines $$\left[b^2\xi\pm\eta\sqrt{b^2\xi^2+a^2\eta^2-a^2b^2},a^2\eta\mp\xi\sqrt{b^2\xi^2+a^2\eta^2-a^2b^2},-(b^2\xi^2+a^2\eta^2)\right].$$ Converting these vectors into Cartesian equations and rearranging a bit produces equation (3).

Observe that this last method is completely general. Having the ellipse in standard position made the calculations simpler, but the result doesn’t depend on this. Neither does the method depend on the conic’s being an ellipse. It will work just as well with a parabola or hyperbola.

• thanks you for this additional work Jun 7, 2017 at 8:55
• I’ve added a direct calculation via decomposition of a rank-2 matrix.
– amd
Jul 21, 2017 at 18:28