# Finding a coordinate over a right angle in a triangle where the other two coordinates are known

      a
B ------- C
\      |
\     |
\    |
c \   | b
\  |
\ |
\|
A


Alright, this is a triangle I have, and these are the things that are known: the coordinates of A and B, the lengths of a and c, as well as the fact that the angle under C is always a right angle. I need to find the coordinates of C.

If you choose to answer this, please be detailed in your explanation of the answer. Thank you.

Edit: I am using this in video game programming. The two objects are parts of a sentry gun. C is at the base of the barrel of the gun, and at a fixed distance (a) from B. B is the gimbal for the gun, and its position does not change. A represents an enemy, whose position does change, and the position of C needs to change on the gimbal (B) to continue pointing at the enemy.

I hope that made my intentions a bit clearer.

So far, all three answers are outside my scope of understanding. My knowledge is really lacking, perhaps too much for me to be able to tackle this problem. I would still like to try, however.

It would help me a lot to see this problem solved using real coordinates. Thank you for your answers so far.

• Welcome to math.SE: since you are new, I wanted to let you know a few things about the site. In order to get the best possible answers, it is helpful if you say in what context you encountered the problem, and what your thoughts on it are; this will prevent people from telling you things you already know, and help them give their answers at the right level. – AlexR Sep 1 '15 at 17:17
• @AlexR Thank you for the guidelines, I have updated my question. – tau-badger Sep 1 '15 at 22:56

## 3 Answers

If you know the coordinates of $A$ and $B$ you can find the length $c$, and since you know $a$, and that $a^2+b^2=c^2$, you can find $c$.

Look at your picture. Thinking of the line from $A$ to $B$ as a mirror, find the image of $C$ in that mirror, and you see that the distances $a$ and $b$ would be the same at that point as at the point $C$ that you've drawn, so there must be two solutions.

One way to proceed is brute force: Let $C=(c_1,c_2)$, $B=(b_1,b_2)$, $A=(a_1,a_2)$. Then \begin{align} b^2 & = (c_1-a_1)^2+(c_2-a_2)^2, \\[2pt] a^2 & = (c_1-b_1)^2+(c_2-a_2)^2. \end{align} Expanding the right sides, we get this system of quadratic equations: \begin{align} b^2 & = c_1^2 - 2c_1 a_1 + a_1^2 + c_2^2 - 2c_2 a_2 + a_2^2, \\[4pt] a^2 & = c_1^2 - 2c_1 b_1 + b_1^2 + c_2^2 - 2c_2 b_2 + b_2^2. \end{align} Subtracting lefts sides and right sides, we get $$b^2-a^2 = 2c_1 (b_1 - a_1) + (a_1^2-b_1^2) + 2c_2(b_2-a_2) + (a_2^2-b_2^2).$$ This is linear in $c_1$ and $c_2$. If you solve it for $c_2$ in terms of $c_1$, then substitute that for $c_2$ in either of the quadratic equations above, you reduce it to a quadratic equation in $c_1$, which has two solutions.

1) Notation: $B = (x_b,y_b), A = (x_a,y_a),C = (x_c,y_c)$

2) The fact that the $\angle C$ is $90^\circ$ helps determine the value of

$b = +\sqrt{c^2 - a^2}$

3) Now you have equation of two circles centered around A and B respectively, with coordinates:

$$C_1 : (x-x_a)^2 + (y-y_a)^2 = b^2$$ $$C_2 : (x-x_b)^2 + (y-y_b)^2 = a^2$$

You need to find a valid intersection of these two circles satisfying the fact that the angle formed by $AC$ and $BC$ is right one.

I am not going past this since you need to show your efforts too. Best of Luck.

• Both points of intersection (assuming a nondegenerate triangle, there are precisely two) will form a right triangle by thales theorem. The solution isn't unique. ($\pm 0$) – AlexR Sep 1 '15 at 18:21

Vector BC

$( x_C -x_B) + i ( y_C-y_B)$

Vector CA

$( x_C -x_A) + i ( y_C- y_A)$

If they are perpendicular, vector dot product = 0

$(x_C -x_B)( x_C -x_A) + ( y_C- y_B)( y_C- y_A) = 0 \tag {1}$

Length of BC is $a$

$( x_C -x_B)^2 ++ ( y_C- y_B) ^2 = a^2 \tag{2}$

Solve these two equations to find coordinates of C.