[Math] Computing coordinates of vertices in a SSS triangle

geometrypythontrigonometry

Given that we know the lengths of the sides of a triangle (SSS), how can the coordinates of the vertices in the Euclidean plane of such a triangle be mathematically computed?

I'm especially looking for a mathematical algorithm to solve this problem. Coordinates would be simple to calculate using a pen and paper, a ruler, and a compass. But how can they be computed?

I see that using the SSS theorem (essentially the law of cosines), the angles of the triangle can be found.

Example:

$XY$ is the line segment connecting two points $X$ and $Y$, where $|XY|$ is the length of segment $XY$.

Given we know $|AB| = 3$, $|BC| = 4$ and $|AC| = 5$, how can we calculate any coordinates of the vertices $A$, $B$ and $C$ that satisfy the given lengths?

Here, an example solution would be $A = (0, 0)$, $B = (1.8, 2.4)$ and $C = (5, 0)$. Of course, lots of other sets of three coordinates would satisfy the given lengths.

Edit: Solution implemented in Python 3

I needed this for creating a program. Here is an implementation of amd's solution in Python 3:

from decimal import Decimal # Decimal used for extra precision

def print_coordinates_of_triangle_given_SSS(a, b, c):
    """a, b and c are lengths of the sides of a triangle"""

    A = (0, 0) # coordinates of vertex A

    B = (c, 0) # coordinates of vertex B

    C_x = b * Decimal(b**2 + c**2 - a**2) / (2 * b * c)
    C_y = Decimal(b**2 - C_x**2).sqrt() # square root

    C = (float(C_x), float(C_y)) # coordinates of vertex C

    # print
    vertices = zip(["A = ", "B = ", "C = "], [A, B, C])
    print('\n'.join([v[0] + str(v[1]) for v in vertices]))

# test -- print coordinates of triangle given sides of length 3, 4 and 5
print_coordinates_of_triangle_given_SSS(3, 4, 5)

It prints possible coordinates of a triangle given the lengths of its sides.

print_coordinates_of_triangle_given_SSS(3, 4, 5) will print

A = (0, 0)
B = (5, 0)
C = (3.2, 2.4)

Best Answer

In order to reduce clutter, let $a=|BC|$, $b=|AC|$ and $c=|AB|$. W.l.o.g. place $A$ at the origin and $B$ at $(c,0)$. The $x$-coordinate of $C$ is then $x_C = b\cos\angle{BAC}$. From the referenced formulas (which are just an application of the Law of Cosines) we have $$\cos\angle{BAC} = {b^2+c^2-a^2 \over 2bc},$$ and by the Pythagorean theorem the $y$-coordinate of $C$ is $y_C = \pm\sqrt{b^2-x_C^2}$.