# Homework Help: Finding the co-ordinates of the 3rd point of a triangle given this?

1. Aug 14, 2014

### supremeruler

On this triangle:

Show a formula for finding co-ordinates of B.

You know:
- the co-ordinates of A and C;
- Angle B = 90 degrees

Is this possible? If not, is it possible if you know all 3 angles?

2. Aug 14, 2014

### micromass

What are your thoughts?

3. Aug 14, 2014

### Mentallic

Try drawing it on graph paper. Choose some values for A and C, such as A = (2,5) and C = (4,1) and see if you can determine where B should be.

4. Aug 14, 2014

### supremeruler

Well on this particular triangle, it's fairly easy.

B.x = C.x
B.y = A.y

BUT the problem is (I forgot to mention this), the triangle could be tilted / rotated any way on a X / Y plane.

5. Aug 14, 2014

### Mentallic

Then no, it's not possible because as you may know, if we drew a circle such that its diameter is AC, then B can lie anywhere on that circle and it'll still be a right triangle.

If you have at least one angle (the other could be determined by the triangle angle sum) then yes, you can give a formula for B.

6. Aug 14, 2014

### skiller

For any triangle, there are 3 side-lengths and 3 internal angles and 3 (potential) coordinates. From your diagram, you may be expecting the one and only answer, or you may be tempted to think that there are 2 answers if you consider the order of ABC as being unimportant - but from the description only, you may find more. Circles may be your friend.

Last edited: Aug 14, 2014
7. Aug 14, 2014

### supremeruler

If I know all 3 angles, what would be the formula?

8. Aug 15, 2014

### Mentallic

It's relatively complicated and its not PF's policy to just give out answers. Have you tried anything? Also, what do you need this for?

9. Aug 15, 2014

### supremeruler

I'm thinking something with intersecting lines and finding the point where they intersect. Not 100% on how to find that though.
I need it to find out the point the user begins to change touch direction in my game.

10. Aug 15, 2014

### Gil

If you know the 3 angles, then you can apply the sines law and the cosines law, and because you know A and B you have a the length of the side "b". From this you get "a" and "c". So, you have 3 angles, the size of the 3 sides and 2 points, getting the last one is easy from here.

11. Aug 15, 2014

### Mentallic

Ahh programming, I thought it might have been that.

If you instead know the gradient of AB or BC as opposed to the angle BAC, then your formula is

$$B=(x,y)=\frac{m}{1+m^2}\left( \frac{x_1}{m}+mx_0+y_1-y_0 \ \textbf{,} \ x_1-x_0+my_1+\frac{y_0}{m} \right)$$

Where $A=(x_0,y_0)$ and $C=(x_1,y_1)$

The gradient of AB = m and BC = -1/m (avoiding m being 0 or undefined).

But in order to use the angles of the triangle to determine the gradient, you need to know the orientation of the triangle with respect to the XY axis including the internal angles of the triangle. This takes a lot of work, and depending on how you want to go about it, you can either use a rotation matrix to change your coordinates such that the triangle is upright as in your picture, or you can use trigonometry.

Gil's idea works too but still takes a hefty amount of algebra to compute the formula.
You can find B by finding the intersection of the 2 circles each centred on A and C respectively, each with the correct distance

(1) - $$(x-x_0)^2+(y-y_0)^2=d_0^2$$

where $d_0=|AC|\cos\theta$ and |AC| is the length of AC, $\theta$ is the angle BAC.

(2) - $$(x-x_1)^2+(y-y_1)^2=d_1^2$$

where $d_1=|AC|\sin\theta$

If you then subtract equation (2) from (1), expand, simplify and rearrange, you get

$$y=-\frac{x_0-x_1}{y_0-y_1}x+\frac{x_0^2-x_1^2}{2(y_0-y_1)}+\frac{y_0+y_1}{2}-\frac{d_0^2-d_1^2}{2(y_0-y_1)}$$

which if you notice is a linear equation of the form y=mx+b. This line goes right through the two points of intersection of the circles.

So now if you plugged this linear equation into (1) say, and simplified, you'd have a quadratic in x which can be solved and would then give you the two x coordinates where those two circles intersect.