Between any two points of a straight line, there always exists an unlimited number of points. I've come across the following problem while skimming over Foundations of Geometry by David Hilbert.

Between any two points of a straight line, there always exists an unlimited number of points.

First, I was given the following advise:

Given a line $a$ and a point $P$ not lying on the line, we say that a point $q$ is on the same side of $a$ as $P$ iff there is no point of $a$ in the segment $PQ$ and we say the point $q$ is in the opposite side of $a$ as $P$ in the opposite case.


Prove that "being on the same side" is an equivalence relation.

Now, say such relation is $\equiv;$ then the difficult part of it is proving the transitivity property, namely, that if $P\equiv Q$ and $Q\equiv R$ then $P\equiv R.$ By Pasch axiom this is trivial if $P,Q$ and $R$ are not collinear, however, if the three are collinear, I have no idea how to prove it...Of course this would lead to the resolution of the main Theorem, but I'm having a lot of difficulties proving that using the Axioms given in Hilbert's book.
Thank you for your help!.
 A: Assume that $P$ and $R$ are distinct points. Then we can find two points $B, C$ between  $P$ and $R$. We can arrange them in order $P, B, C, R$. Then take three points $P=Q, B, C$ - point $B$ lies between $Q$ and $C$. On the other hand, take $B, C, R=Q$ then $C$ lies between $B$ and $Q$. This contradicts the axiom that "Of any three points situated on a straight line, there is always one and only one which lies between the other two."
A: Suppose that $P,Q,R$ are three distinct collinear points and $P \equiv Q$ and $Q \equiv R$, but $P \not \equiv R$. It follows that the segment $\overline{PR}$ intersects the line $a$ at some point $X$. Clearly $X \notin \{P,Q,R\}$. Given the four points $P,Q,R,X$, there is an arrangement of them as $A_1,A_2,A_3,A_4$ such that $A_2$ is between $A_1$ and $A_3$, while $A_3$ is between $A_2$ and $A_4$ (this is Hilbert's discarded axiom which actually follows from other axioms). Since $Q,X$ are between $P$ and $R$, we have $\{Q,X\}= \{A_2,A_3\}$ and $\{P,R\}=\{A_1,A_4\}$. It follows that either $Q=A_2$ and $X=A_3$ or $Q=A_3$ and $X=A_2$. In either case, either $X$ is between $P$ and $Q$ or between $Q$ and $R$. Since $P \equiv Q$ and $Q \equiv R$, we have reached a contradiction.
