Pair of straight lines parallel vs coincident

The equation $ax^2+2hxy+by^2+2gx+2fy+c=0$ represents a pair of parallel lines if $\dfrac{a}{h}=\dfrac{h}{b}=\dfrac{g}{f}$ and the distance between the parallel lines is $2\sqrt{\dfrac{g^2-ac}{a(a+b)}}$ or $2\sqrt{\dfrac{f^2-bc}{b(a+b)}}$

This is given in many references and have been in discussion with Deriving conditions for a pair of straight lines to be parallel and Condition for the pair of lines $𝑎𝑥^2+2ℎ𝑥𝑦+𝑏𝑦^2+2𝑔𝑥+2𝑓𝑦+𝑐=0$ to be parallel.

First part of the statement is attempted to prove as follows:

Let, $l=Ax+By+C=0,k=Dx+Ey+F=0$ be the pair of lines $$ lk=0 $$ Taking partial derivative w.r.t $x$ resulting in the line: $$ L_x=lk'_x+l'_xk=0 $$ Taking partial derivative w.r.t $y$ resulting in the line: $$ L_y=lk'_y+l'_yk=0 $$ Now, $l=0$ and $k=0\implies L_x=0$ and $L_y=0$ : the point of intersection of $l=0,k=0$ are the same as that of $L_x=0,L_y=0$.

$\implies$ when $l=0,k=0$ are coincident, the resulting lines $L_x=0,L_y=0$ are also coincident. ie, all 4 coincide.

$\implies$$\dfrac{a}{h}=\dfrac{h}{b}=\dfrac{g}{f}$

And when $l=0,k=0$ are parallel I don't think we can say much about $L_x=0,L_y=0$ from the equations. So it seems like the condition $\dfrac{a}{h}=\dfrac{h}{b}=\dfrac{g}{f}$ is for coincident lines ?

But plotting an example, check desmos, thanx @ganeshie8 for the help, it seems like if $l=0,k=0$ parallel you'll still get coincident $L_x=0,L_y=0$.

It'd be very helpful if someone could help me clarify this ?

Thanx @David K for the post in Deriving conditions for a pair of straight lines to be parallel. There it is proved that

The equation $𝑎𝑥^2+2ℎ𝑥𝑦+𝑏𝑦^2+2𝑔𝑥+2𝑓𝑦+𝑐=0$ is an equation of two parallel lines if and only if $ℎ^2=𝑎𝑏, 𝑎𝑓=𝑔ℎ, 𝑏𝑔=𝑓ℎ$, and $𝑔^2≥𝑎𝑐$

But, I think all these conditions do not say whether the lines are coincident or just parallel ?, please correct me if I am wrong ?

And how do I prove the distance between the lines to be $2\sqrt{\dfrac{g^2-ac}{a(a+b)}}$ or $2\sqrt{\dfrac{f^2-bc}{b(a+b)}}$ ?


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.