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

Determine third point of triangle (on a 2D plane) when two points and all sides are known?

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


Can someone please explain how to go about this? I understand there will be two possible points and would like to arrive at both.

This is what I've worked out but I'm uncertain at this point how correct it is.

C.x = (AB² - BC² + AC²) / (2 * AB)
C.y = sqrt(BC² - (B.x - C.x)²) - B.y


Thanks!

Update - Need to turn the answer into a reusable formula, solving for C.x and C.y

known sides AB, BC, AC
known points A(x, y), B(x, y)
unknown points C(x, y)

AC² - BC² = ((Ax - Cx)² + (Ay - Cy)²) - ((Bx - Cx)² + (By - Cy)²)

Goal:

C.x = ?
C.y = ?

• – MvG
Nov 4, 2014 at 17:52
• Notice that this is a right triangle (because $3^2+4^2=5^2$). Drawing a picture might help. Apr 15, 2015 at 19:16

The distance between two points $P(p_1,p_2)$ and $Q(q_1,q_2)$ in the plane is$\sqrt{(q_1-p_1)^2+(q_2-p_2)^2}$.

Let us denote coordinates of $C$ by $(x,y)$. Then the distances between from $C$ to $A$ and from $C$ to $B$ will be $$\sqrt{x^2+y^2}=3 \Rightarrow x^2+y^2=9$$ $$\sqrt{(x-5)^2+y^2}=4\Rightarrow (x-5)^2+y^2=16$$ respectively. Substracting the first equation from the second equation we get $$(x-5)^2-x^2=7 \Rightarrow x^2-10x+25-x^2=7$$ $$\Rightarrow -10x+25=7 \Rightarrow x=\frac{-18}{-10}=\frac{9}{5}$$ Now if we substitute $x=\frac95$ into one of the above equations we get $y=\pm \frac{12}5$ So we find $(x,y)=(\frac95,\frac{12}{5})$ and $(x',y')=(\frac95,-\frac{12}{5})$.

As you see from the picture these two points are symmetric w.r.t $-x$ axis.

• I see, can you help me understand how you went from those equations to (9/5,12/5)? Possibly showing the formula to solve for both x and y individually? Thanks for the help.
– boom
Oct 29, 2013 at 19:22
• I edited my post to make it clear for you.
– Ömer
Oct 29, 2013 at 19:40
• Thanks, this is a great answer. I have one more question though if you don't mind. Part of what I need to do is create a reusable formula for x = (C.x) and y = (C.y). I've edited my answer with where I am stuck, any EXTRA :) help is appreciated. Thanks again!
– boom
Oct 29, 2013 at 21:29
• Care to share your final solution for other people having the same question? Mar 12, 2014 at 16:01
• @boom Yes please share! I'm one of those people :p Jul 3, 2014 at 18:19

Given coordinates of $A$ and $B$ and lengths $\overline{AB}$, $\overline{AC}$ and $\overline{BC}$ we want to find coordinates of $C$. Let's assume that $A$ is at $(0,0)$ and $B$ is at $(0,\overline{AB})$ i.e. in the $y$-direction. Let's also assume that we know point $C$ is in the positive $x$-direction (there is another solution in the other direction). It should be simple to reduce a more general problem to this case. The solution is then:

$$C_y = \frac {\overline{AB}^2 + \overline{AC}^2 - \overline{BC}^2} {2\overline{AB}}$$

$$C_x = \sqrt{\overline{AC}^2 - {C_y}^2}$$

The derivation of this is given below:

Consider the triangle $ABC$ as two right angle triangles as shown:

Solution of triangle coordinates

If we call $C_x$ and $C_y$ the coordinates of $C$, then Pythagoras theorem for each of the two triangles gives:

$(1) \qquad \overline{AC}^2 = {C_y}^2 + {C_x}^2$

$(2) \qquad \overline{BC}^2 = (\overline{AB}-C_y)^2 + {C_x}^2$

Rearranging $(1)$ gives

$(3) \qquad {C_x}^2 = \overline{AC}^2-{C_y}^2$

Substituting $(3)$ into $(2)$ and rearranging gives

$$\overline{BC}^2 = (\overline{AB}-{C_y})^2 + \overline{AC}^2-{C_y}^2 = \overline{AB}^2 - 2\overline{AB}\cdot{C_y} + \overline{AC}^2$$

$$C_y = \frac{AB^2 + AC^2 - BC^2}{2\overline{AB}}$$

Since $C_y$ is now known $C_x$ can be found by rearranging $(1)$ to give

$$C_x = \pm \sqrt{\overline{AC}^2 - {C_y}^2}$$

• nice true addressing of "reusable formula", this is how I would do it, except for the choice of the reference system. ;-) Jan 18, 2017 at 15:17
• Maybe I'm an idiot but I can't seem to get the correct answer using this Dec 7, 2021 at 23:32

Here is a solution in JavaScript https://gist.github.com/JulienSansot/d394d210c772a48be067d7e3b856dd1e

//a,b,c are the sides of the triangle
function get_third_point_coordinates(a, b, c){
var result = {x:0,y:0};

if(a > 0){
result.x = (c*c - b*b + a*a) / (2*a);
}

result.y = Math.sqrt(c*c - result.x*result.x);
return result;
}

• Though this solution may be programatically correct, it cannot be accepted as a mathematical solution Apr 6, 2016 at 10:59
• Personally I find the fact this this is written in javascript makes it much easier to understand. However there is no way to feed in the x and y of the first two known points so I don't think this could possible work. Nov 13, 2018 at 8:05

The triangle is Pythagorean. Since $ab=ch$ the second coordinate of $C$ is $\pm12/5$. From $a^2=cp$ the first coordinate of $C$ is $5/9$ thus there are two solutions.

• Sorry, can you elaborate on the formulas used?
– boom
Oct 29, 2013 at 19:09
• Of course. For the first formula note that the area of an Pythagorean triangle is either $ch/2$ or $ab/2$, for the latter refer to en.wikipedia.org/wiki/Geometric_mean_theorem Oct 29, 2013 at 20:12

You can not determine unless there is a direction in the graph.

As i see we have AB,BC,AC. If the way they are written imposes a direction then we see that it is not a directed graph. It would be if the sides would be written AB,BC,CA.

• AB == BA, BC == CB, AC == CA (there will be more than one possible answer)
– boom
Oct 29, 2013 at 10:06
• yes of course.i just wrote an example:)
– Haha
Oct 29, 2013 at 10:29

Here's what I've got: X = (Ax+Bx)/2 plus or minus [(1/2)*sqrt(3)*sqrt((Bx-Ax)^2+(By-Ay)^2)]/[sqrt((-(Bx-Ax)/(By-Ay)+1)]

Then solve for y using any random formula such as the distance formula (since you have x)

Where (X,Y) = unknowns, and (Ax, Ay) is one vertex, and (Bx, By) is another.

Note the above equation may be wrong, but how I can tell you how I got it:

I found the midpoint and opposite reciprocal slope of the line of the two existing vertexes. Then, I found the height of the triangle, which is always half of the base * sqrt(3) due to basic trigonometry. Then, using the midpoint, I used the distance formula and the point-slope formula squared to set up an equation for X and Y, which simplified into the answer above.

I'm going to test in a program soon. Just putting my process out there to see if it helps you.

• Please this this and this on how to better format your mathematics on MathSE. Apr 15, 2015 at 17:34

I am attaching a general solution with some R code.

• We need to a system of equations (with two unknowns) that are logically independent.
• The area of a triangle can be computed using the sides (Heron Area) and can also be compared to the area formula using vertices of the triangle.
• The distance formula mentioned above can be used twice (AC and BC) and these equations can be subtracted.
• Understanding the nature of the problem, there will be two solutions: C and C'
    heronAreaTriangle = function (AB,BC,AC)
{
s = 1/2 * (AB+BC+AC); # semi-perimeter
Area = sqrt(s * (s-AB) * (s-BC) * (s-AC) );
Area; # returns Area
}

findTrianglePointC = function(AB,BC,AC, x_a,y_a, x_b,y_b)
{
M = matrix(0,ncol=2,nrow=2);

Area = heronAreaTriangle(AB,BC,AC);
dy = y_a-y_b; dx = x_a - x_b; dxy = x_a*y_b - y_a * x_b;
y_c = ( dxy + dy * x_c - 2 * Area ) / dx;
x_c = ( (BC^2-AC^2) - x_b^2 - y_b^2 + x_a^2 + y_a^2 - 2*dy*y_c) / (2*dx);

M[1,1]=x_c;
M[1,2]=y_c;

y_c = ( dxy + dy * x_c + 2 * Area ) / dx;
x_c = ( (BC^2-AC^2) - x_b^2 - y_b^2 + x_a^2 + y_a^2 - 2*dy*y_c) / (2*dx);

M[2,1]=x_c;
M[2,2]=y_c;

result = as.data.frame(M);
colnames(result) = c("c_x","c_y");
# result;

list("x_a"=x_a,"y_a"=y_a, "x_b"=x_b,"y_b"=y_b, "AB"=AB,"BC"=BC,"AC"=AC,  "Area"=Area, "result"=result);
}


Usage:

findTrianglePointC(AB,BC,AC, x_a,y_a, x_b,y_b);
findTrianglePointC(5,4,3, 0,0, 5,0);  # the example above

result = findTrianglePointC(5,4,3, 0,0, 5,0);
result;
result$$result; result$$result[1,];
result$$result[2,]; as.numeric(result$$result[2,]);

result$$result[1,]$$c_x;
result$$result[1,]$$c_y;



Output:

> findTrianglePointC(5,4,3, 0,0, 5,0);  # the example above
$x_a [1] 0$y_a
[1] 0

$x_b [1] 5$y_b
[1] 0

$AB [1] 5$BC
[1] 4

$AC [1] 3$Area
[1] 6

\$result
c_x  c_y
1 1.8  2.4
2 1.8 -2.4


The logic is correct, although possible errata may exist (I haven't tried it on several cases).

Sources:

More verbosity about the logic that is simplified above:

determinateAreaTriangle = function (x_a,y_a, x_b,y_b, x_c,y_c)
{
# https://people.richland.edu/james/lecture/m116/matrices/area.html
# https://people.richland.edu/james/lecture/m116/matrices/applications.html
M = matrix(c(x_a,y_a,1, x_b,y_b,1, x_c,y_c,1), ncol=3);
A = abs( 1/2 * det(M) );
A = abs( 1/2 * (x_b*y_c - x_c*y_b - x_a*y_c + x_c*y_a + x_a*y_b - x_b *y_a ) ); # by-hand computation
A;  # returns Area
}

# given points A (x_a,y_a) B (x_b,y_b) and lengths of sides AB, BC, AC
# find coordinates for C (x_c, y_c) which should return two possible answers
# geometry of two intersection circles from two vertices of triangle = two solutions

# heronEquation for area, find numeric value
Area = heronAreaTriangle(AB,BC,AC);
# use determinateAreaTriangle as an equation to help solve simultaneous system
# Area = abs( 1/2 * (x_b*y_c - x_c*y_b - x_a*y_c + x_c*y_a + x_a*y_b - x_b *y_a ) );
# Area = 1/2 * abs ( x_a*y_b - x_b * y_a + x_c * (y_a-y_b) + y_c * (x_b-x_a) );
# 2*Area = abs ( x_a*y_b - y_a * x_b  + x_c * (y_a-y_b) - y_c * (x_a - x_b) );

dy = y_a-y_b; dx = x_a - x_b; dxy = x_a*y_b - y_a * x_b; # deltas of x,y, and innerproduct?

#2*Area = abs ( dxy  + x_c * (dy) - y_c * (dx) );

# y_c = ( dxy + dy * x_c - 2 * Area ) / dx;
# y_c = ( dxy + dy * x_c + 2 * Area ) / dx;

# distance formula (circle definition)
# BC = sqrt( (x_c-x_b)^2 + (y_c-y_b)^2 );
# BC2 = (x_c-x_b)^2 + (y_c-y_b)^2;  # squared is circle formula?
# AC = sqrt( (x_c-x_a)^2 + (y_c-y_a)^2 );
# AC2 = (x_c-x_a)^2 + (y_c-y_a)^2; # squared is circle formula?
# subtract BC2-AC2
# BC2-AC2 = x_b^2 + y_b^2 - x_a^2 - y_a^2 + 2*x_c * (x_a - x_b) + 2*y_c* (y_a-y_b);

# BC2-AC2 = x_b^2 + y_b^2 - x_a^2 - y_a^2 + 2*x_c * (dx) + 2*y_c* (dy);

# solve for x_c in distance formula (for each y_c)
# x_c = ( (BC^2-AC^2) - x_b^2 - y_b^2 + x_a^2 + y_a^2 - 2*dy*y_c) / (2*dx);

# https://people.richland.edu/james/lecture/m116/matrices/applications.html
# A (-2,2), B (1,5) and C (6,-1) ... maybe C' (-1,13)
# x_a = -2; y_a = 2; x_b = 1; y_b = 5; x_c = 6; y_c = -1;
# AB=3*sqrt(2);  BC = sqrt(61); AC=sqrt(73);

# https://math.stackexchange.com/questions/543961/determine-third-point-of-triangle-when-two-points-and-all-sides-are-known
# A (0,0), B (5,0) and C (9/5,12/5) ... maybe C' (9/5,-12/5)
# x_a = 0; y_a = 0; x_b = 5; y_b = 0; x_c = 9/5; y_c = 12/5;
# AB=5;  BC = 4; AC=3;



I would keep simple things simple.

Recognize the Pythagorean triplet of sides $$(3,4,5)$$

Vector approach. Coordinates of C : $$(x,y)$$.

$$\vec{AC}\cdot \vec{BC} =0 \tag1$$ $$(xi+yj)\cdot[ (x-5)i+y j=0] \rightarrow \,x^2+y^2-5 x=0 \tag2$$

This is only a locus, and by Thales theorem or should contain both your points at a right angle vertex.

To isolate points of intersection draw a circle of radius $$3$$ to cut the locus. $$x^2+y^2= 3^2 \tag3$$

Subtracting equations 2) and 3) we get solutions of quadratic equation which has two real roots.

$$x= \frac{9}{5}=1.8 \tag4$$

Plug into either of the two equations for example into the second one 3) $$y^2= 9- (9/5)^2 = \frac{9\times 16}{25}\rightarrow y= \pm2.4$$

Thus two solution points are $$(1.8,+2.4),\,(1.8,-2.4) \tag5$$

which we can label

$$C_1, C_2$$