Get the point at which a line passes through another line perpendicular to it

geometry

I have two line segments that are perpendicular to each other and intersect. I want to know the point of intersection, given one endpoint of one segment and both endpoints of the other. I also know that the other endpoint of the first segment lies on the second segment (and therefore is the point of intersection).

Best Answer

Let $\mathbf{b},\,\mathbf{c}$ be the known endpoints of segment and $\mathbf{a}$ be the known endpoint of the other segment.
For a point $\mathbf{x}$ on the first segment we have $\mathbf{x}=t\mathbf{b}+(1-t)\mathbf{c}$ (see here, point 3. why).
And we have $$(\mathbf{x}-\mathbf{a})\cdot (\mathbf{b}-\mathbf{c})=0$$ $$(t\mathbf{b}+(1-t)\mathbf{c}-\mathbf{a})\cdot (\mathbf{b}-\mathbf{c})=0$$ $$t(\mathbf{b}-\mathbf{c})^2+(\mathbf{c}-\mathbf{a})\cdot (\mathbf{b}-\mathbf{c})=0$$ $$t= \frac{(\mathbf{a}-\mathbf{c})\cdot (\mathbf{b}-\mathbf{c})}{ (\mathbf{b}-\mathbf{c})^2}$$ And thus $$\mathbf{x}=\mathbf{c}+ \frac{(\mathbf{a}-\mathbf{c})\cdot (\mathbf{b}-\mathbf{c})}{ (\mathbf{b}-\mathbf{c})^2}(\mathbf{b}-\mathbf{c})$$


Okay, geometrical intuition behind the answer for the case pure vectors don't make sense:

$\overrightarrow{CX}=\mathbf{x}-\mathbf{c}$ is the normed vector $\overrightarrow{CB}=\mathbf{b}-\mathbf{c}$ (i.e. $\frac{\mathbf{b}-\mathbf{c}}{|\mathbf{b}-\mathbf{c}|}$) multiplied by the length of projection $\overrightarrow{CA}$ onto $\overrightarrow{CB}$.
The length of projection is $$|\overrightarrow{CA}|\cos\angle ACB= |\overrightarrow{CA}| \frac{\overrightarrow{CA}\cdot\overrightarrow{CB}}{ |\overrightarrow{CA}|\cdot|\overrightarrow{CB}|}= \frac{\overrightarrow{CA}\cdot\overrightarrow{CB}}{ |\overrightarrow{CB}|}$$ so the overall result is $$\mathbf{x}-\mathbf{c}= \frac{(\mathbf{a}-\mathbf{c})\cdot(\mathbf{b}-\mathbf{c})}{|\mathbf{b}-\mathbf{c}|} \cdot \frac{\mathbf{b}-\mathbf{c}}{|\mathbf{b}-\mathbf{c}|}$$