Foci of a general conic equation
The general equation of a conic is $A x^2 + B x y + C y^2 + D x + E y + F = 0$. At Wikipedia, there is an equation for the eccentricity, based on ABCDEF.
Is there a similar equation for getting the foci or directrix for a general ellipse, parabola, hyperbola from ABCDEF? Please assume that a non-degenerate form of the equation is given.
geometry conic-sections
Silas PikeSilas Pike
The appropriate setting for this is the complex projective plane. While declaring some symbols, I will talk a tiny bit about that, but do not mistake this as a proper introduction to the subject.
In the projective plane, we use triples $(X:Y:Z)$ of homogenous coordinates for points, not all equal to zero. Two such triples are considered equal if one is a scalar multiple of the other. Affine points $(x,y)$ are embedded as $(x:y:1)$. The equation for the conic in homogenous coordinates is then $$\begin{pmatrix}X\\Y\\Z\end{pmatrix}^\top \underbrace{ \begin{pmatrix}2A & B & D\\B & 2C & E\\D & E & 2F\end{pmatrix} }_M \begin{pmatrix}X\\Y\\Z\end{pmatrix} = 0\tag{1}$$ with the matrix $M$ being regular for a non-degenerate conic.
We also use triples $[U:V:W]$ to represent lines, with a point $(X:Y:Z)$ being on a line $[U:V:W]$ if $UX+VY+WZ = 0$. The equation for the tangents to the conic then takes the form $$\begin{pmatrix}U\\V\\W\end{pmatrix}^\top \underbrace{ \begin{pmatrix}2G & H & R\\H & 2K & S\\R & S & 2T\end{pmatrix} }_{L} \begin{pmatrix}U\\V\\W\end{pmatrix} = 0\tag{2}$$ where $L$ is the matrix inverse of $M$, multiplied with an arbitrary nonzero scalar. Therefore, when given $M$, we can compute a suitable $L$, and if we set $L$ to the adjugate matrix of $M$, we do not even need to carry out divisions for that.
Much useful information about the conic is easier to find in $L$ than in $M$. Examples:
The sign of $T$, compared with the sign of $\det L$, discriminates between ellipse, parabola, and hyperbola.
The projective point $(R:S:2T)$ (third row of $L$) is the (symmetry) center of the conic; if $T=0$, which signifies a parabola, $(R:S)$ indicates the direction of its symmetry axis.
By the way, we can interpret $M$ as a linear map from projective points to projective lines. The linear map represented by $L$ does the reverse. Every point and line thus related form a (pole,polar) pair with respect to the given conic. I will use the linear map feature later. Let me just mention here that the conic equations $(1)$ and $(2)$ can be interpreted as stating that the conic consists of those points that lie on their polars, and in that case the polars are tangents to the conic.
Finally, complex coordinates. We need those for the following:
Proposition 1: Let $F = (x_F:y_F:1)$ be a real finite focus of a non-degenerate conic section with real coefficients. Let $z_F = x_F + \mathrm{i}y_F$ where $\mathrm{i}$ is the imaginary unit. Then the conic has the complex tangent $$q_F = [1:\mathrm{i}:-z_F]\tag{3}$$ In other words, $(2)$ is fulfilled for $[U:V:W] = [1:\mathrm{i}:-z_F]$. The proof is an algebraic exercise left to those readers who can express the entries of the matrix $L$ in terms of focus, directrix, and excentricity from first principles. An expression for the elliptic case is given in another answer.
Note that the line $q_F$ passes through $F$: Just do the dot product to see that. You might take that as a hint at the reason why we need complex numbers here: There are no real tangents to a conic that pass through a focus or through any other interior point.
To apply proposition 1, we plug $[U:V:W] = [1:\mathrm{i}:-z_F]$ into $(2)$. This yields the following equation for $z_F$, with complex coefficients:
$$T\,z_F^2 - (R + \mathrm{i} S)\,z_F + (G - K + \mathrm{i} H) = 0\tag{4}$$
If $T=0$ (parabola), then $(4)$ has a unique solution for $z_F$, giving the finite focus of the parabola. If $T\neq 0$, then $(4)$ is a quadratic equation for $z_F$ whose solutions give both foci. In the case of a circle, both foci coincede.
So basically one just has to memorize "tangent $[1:\mathrm{i}:-z_F]$" in order to deduce equation $(4)$ for the foci.
Now, how to get the directrix associated with the focus $F$?
Proposition 2: The directrix is the polar of the focus.
Therefore, if the directrix is to be presented as a triple $d_F = [U_d:V_d:W_d]$ and the focus is given as $F = (x_F:y_F:1)$, then one just has to compute $$d_F = M\cdot F\tag{5}$$ The proof of that is again left as algebraic exercise. Use the directrix-based formulation of the conic equation to express $M$ suitably.
ccornccorn
You'll first want to check either the discriminant or the eccentricity of your conic before proceeding to use any expression(s) for the foci; the central conics have two foci while the parabola only has one.
For the central conics, it is known that the two foci are at a distance $a\epsilon$ from the center, where $\epsilon$ is the eccentricity and $a$ is the semimajor axis for an ellipse, and the semitransverse axis for a hyperbola.
To simplify things, you'd first want to perform a translation on your central conic, such that the conic's center is now at the origin, and the standard equation becomes
$$\alpha x^2+\beta xy+\gamma y^2=1$$
with that, you can use the formula
$$a=\sqrt{\frac2{\alpha+\gamma+\mathrm{sgn}(\alpha-\gamma)\sqrt{\alpha^2+\beta^2+\gamma^2-2\alpha\gamma}}}$$
along with the eccentricity formula (like the one here) and the formula for the slope of the major/transverse axis to figure out the coordinates of your foci.
The parabolic case is a bit tricky, and I'll leave that to another answerer.
JerryJerry
Not the answer you're looking for? Browse other questions tagged geometry conic-sections or ask your own question.
Comprehensive compilation of conic section formulae
Asymptotes and focus of a conic?
Equation of diagonal ellipse knowing 2 foci and eccentricity
How to see and proof that the hyperbola as a constant difference of distances holds for $\frac{1}{x}$?
Eccentricity of an ellipse
how to simplify a general plane conic section's equation by linear algebra?
How to find centre,vertics,foci,focal radii,letus rectum… when exists of a general quadratic equation in x and y
Conic Equation Simplification
Find foci and eccentricity of ellipse given either 5 points or its general equation
How to determine standard equation of a conic from the general second degree equation?
Conic sections - Hyperbola
Proving that, for any conic, there exists a bijective affine transformation to a special instance (circle, rectangular hyperbola, $y^2=x$ parabola)
Recognizing conic section from the general equation.
Determine conic given two points on the conic and equation of major and minor axis.