Ellipse line intersection calculator
▲
Ellipse equation
x
2
+
y
2
+
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
▲
Ellipse and line general equations
Line equation:
y
=
mx
+
c
Intersection points as a function of h, k and c are:
If h = 0, k = 0, c = 0
ellipse form:
Line form:
y = m x
Or y
1,2
= m x
1,2
If h = 0, k = 0, c ≠ 0
ellipse form:
Line form:
y = m x + c
Or y
1,2
=
m x
1,2
+
c
If h ≠ 0, k ≠ 0, c ≠ 0
ellipse form:
Line form:
y = m x + c
Or
y
1,2
=
m x
1,2
+
c
Where:
φ = c − k
and
μ = c + m h
If h ≠ 0, k ≠ 0, c ≠ 0, x = d
ellipse form:
Line form:
x = d
(vertical line)
x
1,2
= d
If h ≠ 0, k ≠ 0, c ≠ 0, y = d
ellipse form:
Line form:
y = d
(horizontal line)
y
1,2
=
d
Verify the equations of an ellipse and line intersection
▲
Find the intersection points of an ellipse and a line
The ellipse equation is given by:
(1)
Line equation:
y = mx + c
(2)
The center of the ellipse is at (h , k)
Substitute eq.
(2)
into eq.
(1)
Solving for x we have:
b
2
(x − h)
2
+ a
2
(mx + φ)
2
− a
2
b
2
= 0
where
φ = c − k
b
2
x
2
− 2hb
2
x + b
2
h
2
+ a
2
m
2
x
2
+ 2a
2
mφx + φ
2
− a
2
b
2
= 0
x
2
(b
2
+ a
2
m
2
) + x(2a
2
mφ − 2hb
2
) + b
2
h
2
+ φ
2
− a
2
b
2
= 0
The solution of this quadratic equation is:
Finally, we get:
(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 automatically 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
into equation
(1)
.
For ease of calculations, we denote
μ = c
+
m h
b
2
(y − μ)
2
+ a
2
m
2
(y − k)
2
− a
2
m
2
b
2
= 0
b
2
y
2
− b
2
2yμ + b
2
μ
2
2 + a
2
m
2
y
2
− a
2
m
2
2yk + a
2
m
2
k
2
− a
2
m
2
b
2
= 0
y
2
(b
2
+ a
2
m
2
) − y(2b
2
μ + 2a
2
m
2
k) + b
2
μ
2
+ a
2
m
2
k
2
− a
2
m
2
b
2
= 0
Solving this quadratic equation and denote:
Φ = b
2
μ
2
+ a
2
m
2
k
2
− a
2
m
2
b
2
we get:
Finally, we get:
(4)
We could simply substitute the values of x
1,2
into equation
(2)
y = mx + d
and get immediately the correct values of y
1
and y
2
Numeric example of intersection between ellipse and line
▲
Find the coordinates of the intersection of an ellipse given by the equation
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 x
1,2
we get:
From the equation of the line, we can get the y coordinates:
y
1
= 0.5 · 4.28 − 1.25 = 0.89
y
2
= 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:
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
)
Check point (4.28 , 0.89)
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)