# Coordinates of point that is on the end of perpendicular line

Lines AB and CD are perpendicular. Points A, B, D can have any random coordinates and we know there value. Line CD can have any random length and we know its value. How can we calculate coordinates of point C ?

-

## migrated from stackoverflow.comNov 17 '13 at 7:45

This question came from our site for professional and enthusiast programmers.

This question appears to be off-topic because it is about someone's geometry homework. –  talonmies Nov 17 '13 at 7:41
It is not home work. I am self educating myself and I don't have anyone to ask. –  vasili111 Nov 17 '13 at 7:43

Suppose $A(a_1,a_2),B(b_1,b_2)$ and $D(d_1,d_2)$.

The line $(\epsilon_1)$ passing from these points has an equation of the form $Ax+By+C=0$.

Since $DC$ (lets call her $\epsilon_2$ ) is perpendicular to $\epsilon_1$ lets distinquish the following cases:

A. If $\epsilon_1$ has an equation of the form $x=x_0,x_0\in\mathbb{R}$. Then $\epsilon_2$ has an equation of the form $y=y_0,y_0\in\mathbb{R}$. You can easily find $y_0$ from $D$ and then find the coordinates of $C$ from the given length.

B. If $\epsilon_1$ has an equation of the form $y=y_0,y_0\in\mathbb{R}$. Then $\epsilon_2$ has an equation of the form $x=x_0,x_0\in\mathbb{R}$. You can easily find $x_0$ from $D$ and then find the coordinates of $C$ from the given length.

C. If $\epsilon_1$ isn't perpendicular to any of the axes $xx',yy'$ then $\epsilon_1$ has an equation of the form $y=ax+b$ (find $a,b$).Then, $\epsilon_2$ has an equation of the form $y-d_2=\lambda(x-d_1)$ where $\lambda\cdot a=-1$. The circle $C$ with center $D(d_1,d_2)$ and radius the given length $r$ has an equation of the form $(x-d_1)^2+(y-d_2)^2=r^2$. Solving the system of equations for $C$ and $\epsilon_2$ will give you the desired coordinates. (Notice: you'll find 2 points in each case!)

-

First of all, you provide too much information: We need only either A or B, let's say we use A and ignore B. Then you start by calculating the vector A->D: $$\mathbf v = A - D$$ Then calculate the unit vector in that direction: $$\mathbf e = \frac{\mathbf v}{|\mathbf v|}$$ The perpendicular vector can be obtained by exchanging the x and y components, and flipping the sign of one of them: $$\mathbf e'=\binom{-\mathbf e_y}{\mathbf e_x}$$ This vector $\mathbf e'$ points from $D$ to $C$. Finally, given the distance $l$ from $D$ to $C$, you can calculate $C$ as $$C = D + l\mathbf e'$$ Actually, there is another solution: $$C = D - l\mathbf e'$$

-
Strictly speaking, the vector A->D is $D-A$, not $A-D$. (But it gives the same two solutions, just in a different order.) –  TonyK Nov 17 '13 at 12:07