TRI_SSS

This function solves a triangle when all three side lengths are known. It computes all three angles and returns the complete triangle.

The computation uses the Law of Cosines to recover angles from side lengths:

D = \cos^{-1}\!\left(\frac{e^2 + f^2 - d^2}{2ef}\right),\quad E = \cos^{-1}\!\left(\frac{d^2 + f^2 - e^2}{2df}\right),\quad F = \cos^{-1}\!\left(\frac{d^2 + e^2 - f^2}{2de}\right)

Angles are returned in radians.

Excel Usage

=TRI_SSS(d, e, f)
  • d (float, required): First side length (length units).
  • e (float, required): Second side length (length units).
  • f (float, required): Third side length (length units).

Returns (list[list]): A 2D array where the first row is [d, e, f] and the second row is [D, E, F].

Example 1: Solve classic 3-4-5 triangle

Inputs:

d e f
3 4 5

Excel formula:

=TRI_SSS(3, 4, 5)

Expected output:

Result
3 4 5
0.643501 0.927295 1.5708
Example 2: Solve equilateral triangle from equal sides

Inputs:

d e f
6 6 6

Excel formula:

=TRI_SSS(6, 6, 6)

Expected output:

Result
6 6 6
1.0472 1.0472 1.0472
Example 3: Solve isosceles triangle from two equal sides

Inputs:

d e f
5 5 8

Excel formula:

=TRI_SSS(5, 5, 8)

Expected output:

Result
5 5 8
0.643501 0.643501 1.85459
Example 4: Solve scalene triangle from valid side lengths

Inputs:

d e f
7 8 9

Excel formula:

=TRI_SSS(7, 8, 9)

Expected output:

Result
7 8 9
0.841069 1.01948 1.28104

Python Code

from trianglesolver import sss as trianglesolver_sss

def tri_sss(d, e, f):
    """
    Solve a triangle from three known side lengths.

    See: https://pypi.org/project/trianglesolver/

    This example function is provided as-is without any representation of accuracy.

    Args:
        d (float): First side length (length units).
        e (float): Second side length (length units).
        f (float): Third side length (length units).

    Returns:
        list[list]: A 2D array where the first row is [d, e, f] and the second row is [D, E, F].
    """
    try:
        result = trianglesolver_sss(d, e, f)
        return [[result[0], result[1], result[2]], [result[3], result[4], result[5]]]
    except Exception as e:
        return f"Error: {str(e)}"

Online Calculator

First side length (length units).
Second side length (length units).
Third side length (length units).