The dot product of two vectors is zero if the vectors are perpendicular (or if at least one of them has length zero, which won't apply for this problem).
Dot product is the sum of products of the directional components: d = U ⋅ V = Ux*Vx + Uy*Vy (where the subscripts x and y denote the vector components in those respective directions).