[Math] Perpendicular line that crosses specific point

geometry

I know the coordinates of line AB, I also have the coordinates of a point called C.

I need to find the coordinates of the start of a line that is perpendicular to AB and that would cross point C. (Point D)

Also the coordinates of point A are always (0, 0)

enter image description here

enter image description here

Best Answer

Let denote $(x_M,y_M)$ the coordinates of a point $M$. The desired point $D$ is characterized by

$$\vec{MC}\cdot \vec{MA}=\vec{MC}\cdot \vec{MB}=0$$ which means using the coordinates: \begin{align}(x_C-x_M)(x_A-x_M)+(y_C-y_M)(y_A-y_M)&=0\\(x_C-x_M)(x_B-x_M)+(y_C-y_M)(y_B-y_M)&=0\end{align} so solve this system of two equations for the unknowns $x_M$ and $y_M$.