Locating a point based on a condition C and D are two points on the same side of straight line AB. Find a point X on AB such       that the angles CXA and DXB are equal.
How would you go about this?
 A: If I take the reflection of $D$ over line $AB$ as $D'$, then $X$ can be taken as the intersection of segment $AB$ and segment $CD'$. (I should have realised this)

How I originally got this:
By adding a coordinate system and flipping if necessary, assume $A$ is at origin and $B$ is at $(1,0)$. $C$ is at $(x_1,y_1)$ and D is at $(x_2,y_2)$, with $y_1$ and $y_2$ positive.
Let $X$ be a point at $(x, 0)$ on the line $AB$.
$$\begin{align*}
\cot\angle CXA = &\frac{x-x_1}{y_1}\cdot\operatorname{sgn}{x}\\
\cot\angle DXB =& \frac{x-x_2}{y_2}\cdot\operatorname{sgn}{(x-1)}
\end{align*}$$
If $X$ is limited to be on the segment $AB$, $0<x<1$, so the two $\operatorname{sgn}$'s above give different signs:
$$\begin{align*}
\cot\angle CXA =& \cot\angle DXB\\
\frac{x-x_1}{y_1} =& -\frac{x-x_2}{y_2}\\
x=& \frac{x_1y_2 + x_2y_1}{y_1+y_2}
\end{align*}$$
Then it leaves to be checked that such $x$ is between $0$ and $1$. This $x$ can be viewed as the $x$-coordinate which separates $CD$ by $y_1:y_2$.

If such limitation is lifted, then another case is $x<0$ or $x>1$. By similar reasoning as above,
$$x = \frac{x_1y_2 - x_2y_1}{y_2-y_1}$$
Depending on the sign of $y_2-y_1$, this $x$ can be seen as the $x$-coordinate which separates $CD$ by $-y_1:y_2$ or $y_1:-y_2$. And so such $X$ is where line $CD$ intersects line $AB$, if the intersection is outside segment $AB$. This is what @DavidH suggested in the other answer.
A: Hint: Assuming the line CD is not parallel to AB, let X be the point of intersection of the two lines.
Note, the special case that CD is parallel to AB still has to be considered.
