Perpendicular lines are lines that intersect at right angles (90 degrees). Below are two perpendicular lines. One with slope m1 and one with slope m2.

Notice that the two small triangles are not the same way up, so the bigger one is of vertical length -m2. By using Pythagoras’s Theorem on the three right triangles shown above (two small triangles and one large triangle containing the other two), we obtain the following three equations:
| Equation 1. | 12 + m12 = x2 |
| Equation 2. | 12 + (-m2)2 = y2 |
| Equation 3. | x2 + y2 = (m1 + -m2)2 |
. Thus we obtain:
| 12 + m12 + 12 + (-m2)2 = (m1 + -m2)2 | In Equation 3, substitute 12 + m12 for x2
(by Equation 1) and 12 + (-m2)2 for y2 (by Equation 2). |
| 12 + m12 + 12 + (-m2)2 = m12 - 2m1m2 + m22 | Expand the right hand side. Simplify (-m2)2. |
| 12 + m12 + 12 + m22 = m12 - 2m1m2 + m22 | Add 12 + 12 = 2. |
| 2 + m12 + m22 = m12 - 2m1m2 + m22 | Subtract m12 and m22 from both sides. |
| 2 = -2m1m2 | Divide both sides by -2. |
| -1 = m1m2 |
Hence, two lines with slopes m1 and m2 are perpendicular if m1×m2 = -1.