The *dot product* of two vectors (*a*,*b*) and
(*x*,*y*) is defined to be *ax* + *by*. This number will be zero if and
only if the two vectors are perpendicular. We can see this using slopes.
If the first vector lies along the *y*-axis, so *a* =
0, then *ax* + *by* =
0 only if *by* = 0, so either *b* =
0 and (*a*,*b*) = (0,0), or *y* =
0 and (*x*,*y*) lies along the *x*-axis. Thus the
two vectors have dot product 0 if, and only if, they are perpendicular.
Next, if neither vector has slope 0, the vectors (*a*,*b*) and
(*x*,*y*) will be perpendicular if and only if their slopes are
negative reciprocals, i.e. if
(^{b}/_{a})(^{y}/_{x})
= -1 =
^{by}/_{ax}, so -*ax* = *by* and *ax*
+ *by* = 0.

Geometrically, we know that two vectors are perpendicular if the
Pythagorean Theorem holds, i.e. the square of the length of
(*a*,*b*) plus the square of the length of (*x*,*y*)
equals the square of the length of (*a*,*b*)-(*x*,*y*) = (*a*-*x*,*b*-*y*). This means that
*a*^{2} + *b*^{2}
+ *x*^{2} + *y*^{2} = (*a*-*x*)^{2} +
(*b*-*y*)^{2} =
*a*^{2} - 2*ax* + *x*^{2} -
2*by* + *y*^{2}. From this it
follows that 0 = -2*ax* - 2*by*, so *ax* + *by* = 0.