Ellipse line intersection calculator Print ellipse line calculator
Ellipse equation
x2 + y2 + x + y + = 0
(x )2  +  ( y )2  = 1
2 2
Line equation of the form     mx + ny + c = 0
x + y + = 0
Intersection coordinates:
Notes and input limit
           
Ellipse and line intersection summary Print ellipse and line intersection summary
Ellipse and line general equations
Ellipse general form
Line equation:       y = mx + c
Ellipse
Intersection points as a function of  h, k  and  c  are:
If         h = 0,       k = 0,       c = 0
ellipse form: General form of an ellipse with center at (0 , 0)
Line form: y = m x
x_1,2=±ab/√(a^2 m^2+b^2 )
y_1,2=±abm/√(a^2 m^2+b^2 )Or y1,2 = m x1,2
If         h = 0,       k = 0,       c ≠ 0
ellipse form: General form of an ellipse with center at (0 , 0)
Line form: y = m x + c
x_1,2=(-a^2 mc±ab√(a^2 m^2+b^2-c^2 ))/(b^2+a^2 m^2 )
y_1,2=(b^2 c±abm√(a^2 m^2+b^2-c^2 ))/(b^2+a^2 m^2 )Or      y1,2 = m x1,2 + c
If         h ≠ 0,       k ≠ 0,       c ≠ 0
ellipse form: Ellipse general form
Line form: y = m x + c
x_(1,2)=(b^2 h-a^2 mφ±ab√(b^2+a^2 m^2-2mφh-φ^2-m^2 h^2 ))/(b^2+a^2 m^2 )
y_(1,2)=(b^2 δ+a^2 m^2 k±abm√(b^2+a^2 m^2+2δk-k^2-δ^2 ))/(b^2+a^2 m^2 )
Or             y1,2 = m x1,2 + c
Where:         φ = c − k         and         μ = c + m h
If         h ≠ 0,       k ≠ 0,       c ≠ 0,       x = d
ellipse form: (-h)^2/a^2 +(y-k)^2/b^2 =1
Line form: x = d
(vertical line)
y_(1,2)=k±b/a √(a^2-d^2-h^2+2dh)
x1,2 = d
If         h ≠ 0,       k ≠ 0,       c ≠ 0,       y = d
ellipse form: (x-h)^2/a^2 +(d-k)^2/b^2 =1
Line form: y = d
(horizontal line)
x_(1,2)=h±a/b √(b^2-d^2-k^2+2dk)
y1,2 = d
Verify the equations of an ellipse and line intersection Print ellipse and line intersection summary
Find the intersection points of an ellipse and a line
Ellipse
The ellipse equation is given by:
Ellipse general form (1)
Line equation: y = mx + c (2)
The center of the ellipse is at  (h , k)
Substitute eq. (2) into eq. (1)
(x-h)^2/a^2 +(mx+c-k)^2/b^2 =1
Solving for x we have:
b2(x − h)2 + a2(mx + φ)2 − a2b2 = 0 where   φ = c − k
b2x2 − 2hb2x + b2h2 + a2m2x2 + 2a2mφx + φ2 − a2b2 = 0
x2(b2 + a2m2) + x(2a2mφ − 2hb2) + b2h2 + φ2 − a2b2 = 0
The solution of this quadratic equation is:
x_1,2=(b^2 h-a^2 mε±√(a^4 m^2 ε^2-2a^2 mεb^2 h+b^4 h^2-b^4 h^2-b^2 a^2 ε^2+b^4 a^2-a^2 m^2 b^2 h^2-a^4 m^2 ε^2+a^4 m^2 b^2 ))/(b^2+a^2 m^2 )
x_1,2=(b^2 h-a^2 mφ±√((a^2 mφ-b^2 h)^2-(b^2+a^2 m^2 )(b^2 h^2+a^2 φ^2-a^2 b^2 ) ))/(b^2+a^2 m^2 )
Finally we get: x_(1,2)=(b^2 h-a^2 mφ±ab√(b^2+a^2 m^2-2mφh-φ^2-m^2 h^2 ))/(b^2+a^2 m^2 ) (3)
Note: for each  x  value there are two possible  y  coordinates but only one coordinate is on the ellipse see the red points in the drawing, if we find the numeric values of  x  and substitute it in the  y  equation we get otomatically the correct  y  coordinate. If we use the general equation for  y  as found below we have to check the correct  y  coordinate for each  x.
To find the  y  intersection coordinates we substitutes x=(y-c)/m into equation  (1).
x=(y-c)/m
For ease of calculations we denot         μ = c + m h
b2 (y − μ)2 + a2 m2 (y − k)2 − a2 m2 b2 = 0
b2 y2 − b2 2yμ + b2 μ22 + a2 m2 y2 − a2 m2 2yk + a2 m2 k2 − a2 m2 b2 = 0
y2 (b2 + a2 m2) − y(2b2 μ + 2a2 m2 k) + b2 μ2 + a2 m2 k2 − a2 m2 b2 = 0
Solving this quadratic equation and denote:       Φ = b2 μ2 + a2 m2 k2 − a2 m2 b2       we get:
x=(y-c)/m
Finally we get: y_(1,2)=(b^2 δ+a^2 m^2 k±abm√(b^2+a^2 m^2+2δk-k^2-δ^2 ))/(b^2+a^2 m^2 ) (4)
We could simply substitute the values of   x1,2   into equation   (2)     y = mx + d     and get imidiatlly the correct values of   y1   and   y2
Numeric example of intersection between ellipse and line Print ellipse and line intersection summary
Find the coordinates of the intersection of an ellipse given by the equation     (x-2)^2/9+(y+3)^2/36=1
and the line given by    2x − 4y − 5 = 0
From the equation of the ellipse we can see that   a < b   so the ellipse is a vertical ellipse with vertices at:
the y axis at: (h , k −b) (2 , 3 − 6) (2 , 9)
and (h , k + b) (2 , 3 + 6) (2 , 3)
We have             φ = c − k = −5/4 + 3 = 1.75            m = 0.5            a = 3   and   b = 6
Solving equation   (3)   for   x1,2   we get:
x_1,2=(36∙2-9∙0.5∙1.75±3∙6√(36+9∙0.25-2∙0.5∙1.75∙2-〖1.75〗^2-〖0.5〗^2∙4))/(36+9∙〖0.5〗^2 )
x_1,2=(64.125±18√30.6875)/38.25=(64.125±99.713)/38.25=4.28 ,-0.93
From the equation of the line we can get the y coordinates: y=(2x-5)/4=0.5x-1.25
y1 = 0.5 · 4.28 − 1.25 = 0.89 y2 = 0.5 · (0.93) − 1.25 = −1.72
And the intersection coordinates are:       (4.28 , 0.89)     and     (0.93 , −1.72)
If we find the y coordinates according to equation (4) we get:
y_1,2=(36∙(-0.25)+9∙0.25∙(-3)±6∙3∙0.5√(36+9∙0.25+2∙(-0.25)(-3)-9-0.0625))/(36+9∙0.25)
y_1,2=(-15.75±9√30.6875)/38.25=(-15.75±49.86)/38.25=0.89  -1.72
Now we have to decide which  y  is the correct value for each  x  coordinate because the intersection point for example can be:   (4.28 , 0.89)   or   (4.28 , −1.72) for that reason the better method to solve  y  coordinate is by using the value of  y  in the line equation as described before.
Now we have to check which pair of intersection point is located on the ellipse contour.
Check point   (4.28 , −1.72) (x_1-2)^2/9+(y_1+3)^2/36=(4.28-2)^2/9+(-1.72+3)^2/36=0.623
Check point   (4.28 , 0.89) (x_1-2)^2/9+(y_2+3)^2/36=(4.28-2)^2/9+(0.89+3)^2/36=1
We clearly see that the correct intersection point is:   (4.28 , 0.89) and the second point is the remaining coordinates   (0.93 , −1.72)