Suppose ax2+2hxy+by2=0 represents two real lines through the origin (so h2>ab, as in the previous section), with slopes m1 and m2. We can find m1+m2 and m1m2 directly from the coefficients, without first solving for the individual lines. Writing the equation as a quadratic in y/x (dividing by x2, assuming b=0):
b(xy)2+2h(xy)+a=0,
whose roots are precisely m1=y1/x1 and m2=y2/x2, the two slopes. By the sum and product of roots of a quadratic,
m1+m2=−b2h,m1m2=ba.
The angle θ between two lines of slopes m1,m2 satisfies the standard formula tanθ=1+m1m2m1−m2. To express this in terms of a,h,b alone, first compute (m1−m2)2 using the identity (m1−m2)2=(m1+m2)2−4m1m2:
Also, 1+m1m2=1+ba=ba+b. Substituting both into the slope-angle formula, the factor of b cancels between numerator and denominator:
tanθ=ba+bb2h2−ab=a+b2h2−ab.
This is the angle-between-the-lines formula, valid whenever h2>ab (so the square root is real) and a+b=0. When a+b=0 the formula's denominator vanishes, meaning tanθ→∞, i.e. θ=90∘ — the two lines are perpendicular; this special case is examined fully in the next section.
As a worked example, take once more 2x2−3xy−2y2=0, whose lines are x−2y=0 (slope 21) and 2x+y=0 (slope −2). Here a=2, h=−23, b=−2, so a+b=0 and the formula predicts θ=90∘. Checking directly: the product of the slopes is 21×(−2)=−1, which is exactly the condition for two lines to be perpendicular — confirming the formula.
A second worked example shows the formula handling a genuinely acute, non-special angle. Take 2x2−7xy+3y2=0: here a=2, h=−27, b=3, so h2−ab=449−6=425 and a+b=5. Then
tanθ=5225/4=52×25=1,θ=45∘.
Factoring the equation directly gives (2x−y)(x−3y)=0 (slopes 2 and 31), and indeed tanθ=1+2×312−31=5/35/3=1, matching exactly. …