Sylvester problem. A finite set $S$ of points in a plane has the property that a line passing through two of these points passes through a third point. Prove that all the points in $S$ are collinear.
I saw a proof of this problem using extremal principle.
Suppose that the points aren't collinear. Among pairs $(p,L)$ consisting of a line $L$ and a point not on that line, we choose one which minimises the distance $d$ from $p$ to $L$. Let $f$ be the foot of the perpendicular from $p$ to $L$. There are (by assumption) at least three points $a,b,c$ on $L$. This, two of these , say $a$ and $b$ are in the same side of $f$. Let $b $ be nearer to $f$ than $a$. Then the distance from $b$ to line $ap$ is less than $d$. Contradiction.
My question is in the last part. I don't understand how " Then the distance from $b$ to line $ap$ is less than $d$. " produces a contradiction. Can someone explain?
 A: For a visual explanation for why the distance from $B$ to $AP$ is smaller, here's an illustration.  I've capitalized all of the point labels, and added in $G$ and $H$, which are the feet of the perpendiculars from $B$ and $F$ to line $AP$, respectively.  It should be clear that $PF > FH > BG$.  The formal proof uses similar triangles and proportions.

A: In the beginning of the proof we have chosen $(p,L)$ such that the distance $d$ between $p$ and $L$ is minimum amongst all lines and points not on that line.
The contradiction arises when we produced the pair $(b, ap)$ with a distance less than $d$, which contradicts the minimality condition on $(p,L)$.
"Geometry" could be a tag.
EDIT: as to why $b$ is closer to $ap$ than $p$ is to $L$, consider the right-angled triangle $\triangle afp$.
$b$ is on the side $af$. Its distance from the line $ap$ cannot exceed the height of $\triangle afp$ with base $ap$.
Since $ap$ is the hypothenuse, $ap > af$.
Considering the area of $\triangle afp$, we see that the height of $\triangle afp$ with base $ap$ is less than the height of $\triangle afp$ with base $af$, which is $fp = d$.
This gives the desired result: the distance of $b$ from $ap$ is less than $d$.
