The theory of Conic Sections stems from ancient times. It is an example of pure mathematics, which has found applications only many centuries after it
has been developed, e.g. with the laws of planet motion as discovered
by Johannes Keppler. But, interesting as it is, we shall leave aside
history and immediately come to core - or rather
cone - business.
The problem is to intersect a
circular cone with a plane and determine the curves of intersection, like shown
in the above picture. This could be done in the way the old Greek mathematicians
did it. But we prefer to take a path that requires less ingenuity and we shall
employ the means of modern analytical geometry instead. With such an approach,
though, one should be prepared for tedious algebra when working out
the details.
Analysis
A circular cone is characterized by the fact that the angle $\phi$ between
the cone axis and its surface is a constant. Let the unit vector $\vec{a}$ be
the direction of the cone axis and let $\vec{p}$ point to the top vertex of the
cone. An arbitrary point at the surface of the cone is pinpointed by $\vec{r}$.
Then the following is an equation of the cone surface:
$$
(\vec{a}\cdot\vec{r}-\vec{p}) = |\vec{a}||\vec{r}-\vec{p}|\cos(\phi)
$$
Square both sides:
$$
(\vec{a}\cdot\vec{r}-\vec{p})^2 =
(\vec{a}\cdot\vec{a})(\vec{r}-\vec{p}\cdot\vec{r}-\vec{p})\cos^2(\phi)
$$
And work out:
$$
(\vec{a}\cdot\vec{r})^2 - 2(\vec{a}\cdot\vec{p})(\vec{a}\cdot\vec{r})
+ (\vec{a}\cdot\vec{p})^2 = \cos^2(\phi) \left\{
(\vec{r}\cdot\vec{r}) - 2(\vec{p}\cdot\vec{r}) + (\vec{p}\cdot\vec{p})\right\}
$$
The unit vector $\vec{a}$ can be written as:
$$
\vec{a} = \left[
\cos(\alpha)\cos(\gamma),\cos(\alpha)\sin(\gamma),\sin(\alpha)\right]
$$
Where $\alpha$ is the angle between the cone axis and the XY-plane and $\gamma$
is an angle that indicates how the conic section is rotated in the plane.
The vector of the top of the cone can be written in its coordinates as:
$$
\vec{p} = (p,q,h)
$$
Where $h$ is the height of the cone above the XY plane and $(p,q)$ indicates
how the conic section is translated in the plane. Last but not least, the vector
pointing to the cone surface is written as:
$$
\vec{r} = (x,y,z)
$$
Where the intersections with the XY plane are found for $z = 0$. Let's do just
that and work out the above:
$$
\begin{cases}
(\vec{a}\cdot\vec{r}) &=&
\cos(\alpha)\cos(\gamma)\,x + \cos(\alpha)\sin(\gamma)\,y \\
(\vec{a}\cdot\vec{p}) &=&
\cos(\alpha)\cos(\gamma)\,p + \cos(\alpha)\sin(\gamma)\,q + \sin(\alpha)\,h \\
(\vec{r}\cdot\vec{r}) &=& x^2 + y^2 \\
(\vec{p}\cdot\vec{r}) &=& p\,x + q\,y \\
(\vec{p}\cdot\vec{p}) &=& p^2 + q^2 + h^2
\end{cases}
$$
Collecting powers of $x$ and $y$ results in:
$$
A\,x^2 + B\,xy + C\,y^2 + D\,x + E\,y + F = 0
$$
Where:
$$
\begin{cases}
A &=& \cos^2(\phi) - \cos^2(\alpha)\cos^2(\gamma) \\
B &=& - 2 \cos^2(\alpha)\cos(\gamma)\sin(\gamma) \\
C &=& \cos^2(\phi) - \cos^2(\alpha)\sin^2(\gamma) \\
D &=& 2 \left\{ \cos(\alpha)\cos(\gamma) (\vec{a}\cdot\vec{p})
- \cos^2(\phi)\,p \right\} \\
E &=& 2 \left\{ \cos(\alpha)\sin(\gamma) (\vec{a}\cdot\vec{p})
- \cos^2(\phi)\,q \right\} \\
F &=& (\vec{p}\cdot\vec{p}) \cos^2(\phi) - (\vec{a}\cdot\vec{p})^2
\end{cases}
$$
Meaning
The first three coefficients of the conic section equation are:
$$
\begin{cases}
A &=& \cos^2(\phi) - \cos^2(\alpha)\cos^2(\gamma) \\
B &=& - 2 \cos^2(\alpha)\cos(\gamma)\sin(\gamma) \\
C &=& \cos^2(\phi) - \cos^2(\alpha)\sin^2(\gamma)
\end{cases}
$$
All kind of conics can still be produced if the angles $\phi$ and $\alpha$ are
limited to sensible values:
$$
\begin{cases}
&&0 < \phi < 90^o \quad \Longrightarrow \quad 0 < \cos(\phi) < 1 \\
&&0 \le \alpha \le 90^o \quad \Longrightarrow \quad 0 \le \cos(\alpha) \le 1
\end{cases}
$$
Generality is not affected by these choices. Moreover it is seen from the picture
below that the form of the conic section is determined
by the angles $\phi$ and $\alpha$ and nothing else. Therefore the ratio of the
two angles will be defined here as the excentricity ($\epsilon$) of the
conic section:
$$
\epsilon = \frac{\cos(\alpha)}{\cos(\phi)}
$$
The following relationships exist between the excentricity and the form of a
conic section, as is clear from the picture:
$$
\begin{cases}
\mbox{Circle : }& \alpha = 90^o &\quad \Longleftrightarrow \quad \epsilon = 0 \\
\mbox{Ellipse : }& \alpha > \phi &\quad \Longleftrightarrow \quad \epsilon < 1 \\
\mbox{Parabola : }& \alpha = \phi &\quad \Longleftrightarrow \quad \epsilon = 1 \\
\mbox{Hyperbola : }& \alpha < \phi &\quad \Longleftrightarrow \quad \epsilon > 1
\end{cases}
$$
So far so good. The coefficients $(A,B,C)$ can be combined into
some interesting quantities which are only dependent upon form,
that is: the angles $\phi$ and $\alpha$.
It is remarked in the first place that $(A,B,C)$ are independent of the vector
$\vec{p} = (p,q,h)$ and thus independent of translation and scaling. If we seek
to eliminate any dependence upon the angle of rotation $\gamma$, then we find:
$$
A + C = 2 \cos^2(\phi) - \cos^2(\alpha) = \cos^2(\phi) (2 - \epsilon^2)
$$
This quantity is known (for some good reasons) as the trace of the conic
section. Instead of eliminating the angle of rotation, we could also try
to calculate it.
$$
A - C = - \cos^2(\alpha)\left[\cos^2(\gamma)-\sin^2(\gamma)\right]
= - \cos^2(\alpha)\cos(2\gamma)
$$
There is a striking resemblance with:
$$
B = - \cos^2(\alpha)\sin(2\gamma)
$$
We thus find:
$$
\frac{B}{A - C} = \frac{\sin(2\gamma)}{\cos(2\gamma)} \quad \Longrightarrow \quad
\tan{2\gamma} = \frac{B}{A - C}
$$
Herewith - in principle - the angle of rotation $\gamma$ can be reconstructed
from the conic section equation; provided that $A \neq C$.
Let's proceed with
another quantity that is independent of any rotation.
$$
B^2 - 4 A C = \left[ - 2 \cos^2(\alpha)\cos(\gamma)\sin(\gamma) \right]^2
$$ $$
- 4 \left[ \cos^2(\phi) - \cos^2(\alpha)\cos^2(\gamma) \right]
\left[ \cos^2(\phi) - \cos^2(\alpha)\sin^2(\gamma) \right]
$$
This quantity is known (also for some good reasons) as the determinant or
discriminant of the conic section. Work out:
$$
= 4 \cos^4(\alpha)\cos^2(\gamma)\sin^2(\gamma) - 4 \cos^4(\phi)
- 4 \cos^4(\alpha)\cos^2(\gamma)\sin^2(\gamma) \\
+ 4 \cos^2(\phi)\cos^2(\alpha)\left[\cos^2(\gamma)+\sin^2(\gamma)\right] \\
= - 4\cos^4(\phi) + 4\cos^2(\phi)\cos^2(\alpha) \\
\quad \Longrightarrow \quad B^2 - 4 A C
= 4\cos^2(\phi)\left[\cos^2(\alpha) - \cos^2(\phi)\right]
= \left[2\cos^2(\phi)\right]^2(\epsilon^2 - 1)
$$
The following relationships exist between the discriminant and the form of a
conic section, as is clear from the above:
$$
\begin{cases}
&\mbox{Ellipse}& \quad \Longleftrightarrow \quad \epsilon < 1 \quad \Longleftrightarrow \quad (B^2 - 4 A C) < 0 \\
&\mbox{Parabola}& \quad \Longleftrightarrow \quad \epsilon = 1 \quad \Longleftrightarrow \quad (B^2 - 4 A C) = 0 \\
&\mbox{Hyperbola}& \quad \Longleftrightarrow \quad \epsilon > 1 \quad \Longleftrightarrow \quad (B^2 - 4 A C) > 0
\end{cases}
$$
BONUS on excentricity.
$$
(A + C)^2 = 4\cos^2(\phi)\left[\cos^2(\phi) - \cos^2(\alpha)\right]
+ \cos^4(\alpha)
$$
Upon addition this gives:
$$
(B^2 - 4 A C) + (A + C)^2 = \cos^4(\alpha) \quad \Longrightarrow \\
\cos(\alpha) = \sqrt{\sqrt{B^2 + (A-C)^2}}
$$
About the angle $\phi$ between the cone axis and its surface:
$$
A + C = 2\cos^2(\phi) - \sqrt{B^2 + (A-C)^2} \quad \Longrightarrow \quad
\cos(\phi) = \sqrt{\frac{(A+C) + \sqrt{B^2 + (A-C)^2}}{2}}
$$
Herewith the excentricity $\epsilon$ can be expressed into the coefficients of
the conic section equation $(A,B,C)$:
$$
\epsilon = \sqrt{\frac{2\sqrt{B^2 + (A-C)^2}}
{(A+C) + \sqrt{B^2 + (A-C)^2}}}
$$
Many other expressions can be derived, especially for the coefficients $D,E,F$.
But I think that deriving them here will disturb a good balance between interesting and cumbersome.
EDIT. Explanation of
$$
\vec{a} = \left[
\cos(\alpha)\cos(\gamma),\cos(\alpha)\sin(\gamma),\sin(\alpha)\right]
$$
See picture. Overline denotes " length of " in:
$$
\overline{OZ}=\overline{OA}\, \sin(\alpha) \quad ; \quad
\overline{OD}=\overline{OA}\, \cos(\alpha) \\
\overline{OX}=\overline{OD}\, \cos(\gamma) \quad ; \quad
\overline{OY}=\overline{OD}\, \sin(\gamma)
$$
With $\overline{OA}=1$ .
Best Answer
I should have read your links and their comments before starting an answer. That would have saved a big waste of time.
I have posted an alternative proof in an answer to Deriving conditions for a pair of straight lines to be parallel.. I do not think the approach using partial derivatives in that question is a good one.
The condition $\frac ah=\frac hb=\frac gf$ tells us that the equation $ax^2+2hxy+by^2+2gx+2fy+c=0$ is either the equation of two parallel lines, the equation of one line (which could be regarded as "two parallel lines" that are coincident), or the equation of nothing.
The question of whether $ax^2+2hxy+by^2+2gx+2fy+c=0$ is satisfied by any points at all cannot be answered merely by looking at $a,$ $b,$ $f,$ $g,$ and $h.$ You also have to look at $c.$
If $\frac ah=\frac hb=\frac gf,$ a necessary additional condition to have a solution at all is either $g^2 \geq ac$ or $f^2 \geq bc.$ This could be guessed by looking at the formulas for the distance between the lines, realizing that $a$ and $b$ must have the same sign (because $ab = h$), and realizing that the expressions inside the square roots are non-negative only if $g^2 - ac$ or $f^2 - bc$ are non-negative.
An additional condition to have one line instead of two is either $g^2 = ac$ or $f^2 = bc,$ which puts a zero inside the square root.
Regarding the second part of the question, namely, how we can show that the distance between the parallel lines is $2\sqrt{\frac{g^2-ac}{a(a+b)}}$ or $2\sqrt{\frac{f^2-bc}{b(a+b)}}$:
We suppose in all of the following that $ax^2+2hxy+by^2+2gx+2fy+c=0$ is the equation of one line or two parallel lines.
For simplicity, let's just consider $2\sqrt{\frac{g^2-ac}{a(a+b)}}$ at first. This formula obviously works only if $a \neq 0.$ Otherwise you would be dividing by zero. So assume $a\neq 0.$ It follows that $h\neq 0.$
Then as I showed in my answer to Deriving conditions for a pair of straight lines to be parallel., we can rewrite $ax^2+2hxy+by^2+2gx+2fy+c=0$ as $$ a(x+By)^2 + 2g(x+By) + c = 0 $$ where $B=\frac ha = \frac bh.$ The two lines are parallel to the line $x+By=0$ and perpendicular to the line $Bx-y=0.$ To find the distance between the lines we can take the distance between their intersection points with that perpendicular line.
To find the intersection points of the two lines with $Bx-y=0,$ we can set $y=Bx$ in $a(x+By)^2 + 2g(x+By) + c = 0,$ which gives us the equation $$ a(x+B^2x)^2 + 2g(x+B^2x) + c = 0. $$ Solving this as a quadratic in $x+B^2x,$ $$ x+B^2x = \frac{-g \pm \sqrt{g^2 - ac}}{a}. $$ Pulling the factor $1+B^2 = 1 + \frac ba$ out of each side, we get $$ x = \frac{-g \pm \sqrt{g^2 - ac}}{a + b}. $$ Since we have assumed the equation has a solution, this gives us $x$ coordinates separated by a horizontal distance $$\Delta x = 2\frac{\sqrt{g^2 - ac}}{a + b}.$$
Meanwhile, since $y = Bx = \left(\sqrt{\frac ba}\right)x$ at the two intersection points with the perpendicular line, the $y$ coordinates of these points are separated by a vertical distance $$\Delta y = 2\left(\sqrt{\frac ba}\right)\frac{\sqrt{g^2 - ac}}{a + b}.$$
The total distance between the two intersection points is therefore \begin{align} \sqrt{(\Delta x)^2 + (\Delta y)^2} &= \sqrt{4\frac{g^2 - ac}{(a + b)^2} + 4\left({\frac ba}\right)\frac{g^2 - ac}{(a + b)^2}} \\ &= \sqrt{4\left({1+\frac ba}\right)\frac{g^2 - ac}{(a + b)^2}} \\ &= 2\sqrt{\left(\frac{a+b}{a}\right)\frac{g^2 - ac}{(a + b)^2}} \\ &= 2\sqrt{\frac{g^2 - ac}{a(a + b)}}. \end{align}
The proof that the distance is $2\sqrt{\frac{f^2-bc}{b(a+b)}}$ when $b\neq 0$ is similar.