If I have three points, is there an easy way to tell if they are collinear? Points $(a,b)$, $(m,n)$, and $(x,y)$ are selected at random. What is the quickest/easiest way to tell if they are collinear? At first I thought it was a matter of comparing slopes but that doesn't appear to be enough.
 A: This is an explanation of $\textbf{Ma Ming}$'s excellent idea, in case it was unclear.
Consider a triangle with vertices at points $(a,b)$, $(m,n)$, and $(x,y)$, and observe that the area $A$ of the triangle is zero if and only if the points are collinear. Now, it can be shown that
$$A=\frac{1}{2}\left|\det\pmatrix{1&1&1\\a&m&x\\b&n&y}\right|=\frac{1}{2}\left|a(n−y)+m(y−b)+x(b−n)\right|.$$
Hence we just have to check whether the expression $a(n−y)+m(y−b)+x(b−n)$ is non-zero or not.
A: The area is zero, in formula $\det \pmatrix{1 &a &b\\
               1 &m &n\\
               1 &x &y}=0$
A: "At first I thought it was a matter of comparing slopes"... and you were right!
If the line segments AB and BC have the same slope, then A, B, C are necessarily collinear. Note that there are some corner cases having to do with whether B is the "middle" point or not (in which case the slopes will still be equal), and one having to do with vertical lines (where some formula you use to compute slope might divide by 0).
Putting all this together, the points $(a, b)$, $(m, n)$ and $(x, y)$ are collinear if and only if $$(n-b)(x-m) = (y-n)(m-a)$$
(comes from $\frac{n-b}{m-a} = \frac{y-n}{x-m}$, but not writing it in fraction form to avoid division by $0$).
A: Another way is to choose any two of the three points to construct a pair of parametric equations for the line they lie on, say,
$$X \ = \ a \ + \ (m - a) \cdot t \ , \ Y \ = \ b \ + \ (n - b) \cdot t \ , $$
with $ \ t \ $ being the parameter.  For the third point, $ \ (x, y) \ $ , find the value of a parameter $ \ s \ $ which solves $ \ x \ = \ a \ + \ (m - a) \cdot s \ $ .  If the same value $ \ s \ $ produces an equation for $ \ y \ = \ b \ + \ (n - b) \cdot s \ , $ then the three points are collinear; otherwise... they aren't!
This approach can be extended without much difficulty to deal with the reference line being horizontal or vertical (so there is no complication with things like undefined slopes).
