TITLE: How to determine if 2 points are on opposite sides of a line
QUESTION [6 upvotes]: How can I determine whether the 2 points $(a_x, a_y)$ and $(b_x, b_y)$ are on opposite sides of the line $(x_1,y_1)\to(x_2,y_2)$?

REPLY [9 votes]: Explicitly, they are on opposite sides iff
$$((y_1-y_2)(a_x-x_1)+(x_2-x_1)(a_y-y_1))((y_1-y_2)(b_x-x_1)+(x_2-x_1)(b_y-y_1)) < 0.$$