If two lines are perpendicular, then \(m_{1}m_{2}=-1\) where \(m_{i}\) is the slope of the line.
Proof Without Trigonometry
Here’s the basic idea. Let the two lines be of the form \(y=m_{i}x+b_{i}\).
Find the point of intersection of the two lines. Call this point \(O\).
Now take a point on line 1 and call it \(B\). Likewise take a point on line 2 and call it \(A\).
Write down the expression for \(d(OA)\) and \(d(OB)\). These are the two legs of a right triangle. The hypotenuse is \(d(AB)\). Use Pythagora’s Theorem and solve for \(m_{1},m_{2}\).
Now if you do it this way, it will be very messy. The trick to simplify is to realize that if you modify the y-intercepts (\(b_{i}\)), the lines are still perpendicular. So you’re free to set \(b_{1}=b_{2}=0\).
Nevertheless, below is Sage code to do this in its full glory.
y, x, b1, b2, m1, m2, xa, ya, xb, yb, x0, y0, ytmp = var('y x b_1 b_2 m_1 m_2 x_a y_a x_b y_b x_0 y_0 ytmp') x0 = solve([m1*x+b1==m2*x+b2], x) print(f"Intersection point: x-coordinate: {x0[0]}") x0 = x0[0].rhs() y0 = m1*x0 + b1 print(f"Intersection point: y-coordinate: {y0.full_simplify()}") ytmp = m2*x0+b2 print(f"Intersection point: y-coordinate (calculated using the other line): {ytmp.full_simplify()}") ya = m2*xa + b2 yb = m1*xb + b1 LHS = (ya-y0)^2 + (xa-x0)^2 + (yb-y0)^2 + (xb-x0)^2 print("Distance between intersection point and point A:") LHS RHS = (xa-xb)^2 + (ya-yb)^2 print("Distance between intersection point and point B:") RHS Diff = LHS-RHS print("Equating the two and solving:") X = solve([LHS==RHS], m1, m2) X X[2][0]*X[2][1]
Intersection point: x-coordinate: x == -(b_1 - b_2)/(m_1 - m_2) Intersection point: y-coordinate: (b_2*m_1 - b_1*m_2)/(m_1 - m_2) Intersection point: y-coordinate (calculated using the other line): (b_2*m_1 - b_1*m_2)/(m_1 - m_2) Distance between intersection point and point A: (m_2*x_a - b_1 + b_2 + (b_1 - b_2)*m_1/(m_1 - m_2))^2 + (m_1*x_b + (b_1 - b_2)*m_1/(m_1 - m_2))^2 + (x_a + (b_1 - b_2)/(m_1 - m_2))^2 + (x_b + (b_1 - b_2)/(m_1 - m_2))^2 Distance between intersection point and point B: (m_2*x_a - m_1*x_b - b_1 + b_2)^2 + (x_a - x_b)^2 Equating the two and solving: [[m_1 == r1, m_2 == (r1*x_a + b_1 - b_2)/x_a], [m_1 == r2, m_2 == (r2*x_b + b_1 - b_2)/x_b], [m_1 == -1/r3, m_2 == r3]] m_1*m_2 == -1
Note the last solution. The other two solutions are the equivalent of \(m_{1}=m_{2}\) when you let \(b_{1}=b_{2}\).
Proof Using Trigonometry
Note that the slope is the tangent of the angle the line makes with the x-axis.
We know the difference between the two lines is \(\pi/2\). Specifically:
Now \(\tan(\pi/2)\) has a singularity. This will occur only if the denominator is 0. Hence the identity.