Trigonometry – Calculate Coordinates of Third Vertex of Triangle Given Two Vertices and Edge Lengths

trianglestrigonometry

I simply have a triangle.. say abc . Given coordinates of a & b. and the length of
ac and bc..

I can calculate the length between ab via the distance square rule.

$D = \sqrt{(X_2 – X_1)^2 + (Y_2 – Y_1)^2} $

I have tried to use the distance rule to compute the third vertex, but it has a lot of steps..
I wonder if there is another method.. that yields the two possible solutions for the vertex

Best Answer

Let $A = (x_A, y_A)$ and $B = (x_B,y_B)$ the known vertices of your triangle. Let's call $d_{AB}$, $d_{BC}$ and $d_{CA}$ the lengths of each side.

  1. Translate your points subtracting $x_A$ and $y_A$ so that $A$ corresponds with the origin. That is:

$$A' = (0, 0), B' = (x_B-x_A, y_B-y_A ) = (x_B', y_B').$$

  1. Rotate $B'$ so that it lies on the $x$-axis. This can be done without knowing the angle, indeed:

$$A'' = (0,0), B'' = (d_{AB}, 0).$$

Anyway, the value of the rotation angle is important for the next steps. In particular it is $$\theta = \arctan2\left(y_B-y_A,x_B-x_A\right),$$

where $\arctan2(\cdot, \cdot)$ is defined in details here.

  1. At this point, it is easy to find $C''$. Notice that there are two solutions, since the point $C''$ can be placed above or below the side $AB$.

$$x_C'' = \frac{d_{AB}^2+d_{AC}^2-d_{BC}^2}{2d_{AB}},$$

and

$$y_C'' = \pm\frac{\sqrt{(d_{AB}+d_{AC}+d_{BC})(d_{AB}+d_{AC}-d_{BC})(d_{AB}-d_{AC}+d_{BC})(-d_{AB}+d_{AC}+d_{BC})}}{2d_{AB}}.$$

  1. Now, rotate back your point $C''$ using $-\theta$ (see step 2), thus obtaining $C'$.
  2. Finally, translate $C'$ by adding $x_A$ and $y_A$ to the components in order to obtain $C$.