# Determine third point of triangle when two points and all sides are known

I am solving basically the same problem as asked in this thread Determine third point of triangle when two points and all sides are known? I know 3 sides of a triangle and positions of two of them. And I need to determine the coordinates of the last point.

For example:

|AB| = 3
|AC| = 4
|BC| = 5
A(0,0)
B(3,0)
C(?,?)


However, I need a general solution to apply it in my program code. I know it is pretty easy to calculate this on the paper by solving the first equation and then using the result in the other equation:

$$1.\ \ \ \ \ \ (C_x - B_x)^2 + (C_y - B_y)^2 = |BC|^2$$ $$2.\ \ \ \ \ \ (C_x - A_x)^2 + (C_y - A_y)^2 = |AC|^2$$

When I try to calculate a general solution $C_x = ?$ and $C_y = ?$, I'm getting a terribly complicated equation and I can't reach the end.

I got to this point:

$$C_x = B_x \pm \sqrt{|BC|^2 - B_y^2 + 2B_yC_y - C_y^2}$$

and then when I try to put this equation to the second one I get this:

$$B_x^2 - B_y^2 + A_x^2 + A_y^2 + |BC|^2 - |AC|^2 + 2B_yC_y - 2A_xB_x - 2C_yA_y - 2A_x\sqrt{|BC|^2 - B_y^2 + 2B_yC_y - C_y^2} + 2B_x\sqrt{|BC|^2 - B_y^2 + 2B_yC_y - C_y^2} = 0$$

Is it really that complicated or am I making a mistake somewhere? I'm not a mathematical freak but I assume that there are only two possible solutions.

When I tried to input these equations into Wolfram Alpha I'm getting several different results, each spanning up to several lines :-((

• If you showed what you have gotten so far we could tell you whether it is really that complicated. – David K Nov 4 '14 at 16:46
• I expanded the question but I'm not sure if it's of any help :-( – samuelg0rd0n Nov 4 '14 at 17:08
• – MvG Nov 4 '14 at 17:51
• It can be simplified a little. Instead of using just one equation to get $C_x$ in terms of $C_y$, you can subtract one equation from the other and get a linear formula (see math.stackexchange.com/a/256123/139123); plugging this into one of the equations, you then have a quadratic in one variable. – David K Nov 4 '14 at 20:27
• Also if you look for "Intersection of Two Circles" on paulbourke.net/geometry/circlesphere there is another method with links to source code in various programming languages. – David K Nov 4 '14 at 20:34