# Solution of triangles

Solution of triangles (Latin: solutio triangulorum) is the main trigonometric problem of finding the characteristics of a triangle (angles and lengths of sides), when some of these are known. The triangle can be located on a plane or on a sphere. Applications requiring triangle solutions include geodesy, astronomy, construction, and navigation.

## Solving plane triangles

A general form triangle has six main characteristics (see picture): three linear (side lengths a, b, c) and three angular (α, β, γ). The classical plane trigonometry problem is to specify three of the six characteristics and determine the other three. A triangle can be uniquely determined in this sense when given any of the following:

• Three sides (SSS)
• Two sides and the included angle (SAS)
• Two sides and an angle not included between them (SSA), if the side length adjacent to the angle is shorter than the other side length.
• A side and the two angles adjacent to it (ASA)
• A side, the angle opposite to it and an angle adjacent to it (AAS).
• Three angles (AAA) on the sphere (but not in the plane).

For all cases in the plane, at least one of the side lengths must be specified. If only the angles are given, the side lengths cannot be determined, because any similar triangle is a solution.

### Trigonomic relations

The standard method of solving the problem is to use fundamental relations.

Law of cosines
$a^{2}=b^{2}+c^{2}-2bc\cos \alpha$
$b^{2}=a^{2}+c^{2}-2ac\cos \beta$
$c^{2}=a^{2}+b^{2}-2ab\cos \gamma$
Law of sines
${\frac {a}{\sin \alpha }}={\frac {b}{\sin \beta }}={\frac {c}{\sin \gamma }}$
Sum of angles
$\alpha +\beta +\gamma =180^{\circ }$
Law of tangents
${\frac {a-b}{a+b}}={\frac {\tan[{\frac {1}{2}}(\alpha -\beta )]}{\tan[{\frac {1}{2}}(\alpha +\beta )]}}.$

There are other (sometimes practically useful) universal relations: the law of cotangents and Mollweide's formula.

## Solving spherical triangles

The general spherical triangle is fully determined by three of its six characteristics (3 sides and 3 angles). The lengths of the sides a, b, c of a spherical triangle are their central angles, measured in angular units rather than linear units. (On a unit sphere, the angle (in radians) and length around the sphere are numerically the same. On other spheres, the angle (in radians) is equal to the length around the sphere divided by the radius.)

Spherical geometry differs from planar Euclidean geometry, so the solution of spherical triangles is built on different rules. For example, the sum of the three angles α + β + γ depends on the size of the triangle. In addition, similar triangles cannot be unequal, so the problem of constructing a triangle with specified three angles has a unique solution. The basic relations used to solve a problem are similar to those of the planar case: see Spherical law of cosines and Spherical law of sines.

Among other relationships that may be useful are the half-side formula and Napier's analogies:

• $\tan {\frac {c}{2}}\cos {\frac {\alpha -\beta }{2}}=\tan {\frac {a+b}{2}}\cos {\frac {\alpha +\beta }{2}}$
• $\tan {\frac {c}{2}}\sin {\frac {\alpha -\beta }{2}}=\tan {\frac {a-b}{2}}\sin {\frac {\alpha +\beta }{2}}$
• $\cot {\frac {\gamma }{2}}\cos {\frac {a-b}{2}}=\tan {\frac {\alpha +\beta }{2}}\cos {\frac {a+b}{2}}$
• $\cot {\frac {\gamma }{2}}\sin {\frac {a-b}{2}}=\tan {\frac {\alpha -\beta }{2}}\sin {\frac {a+b}{2}}.$

### Three sides given (spherical SSS)

Known: the sides a, b, c (in angular units). The triangle's angles are computed using the spherical law of cosines:

$\alpha =\arccos \left({\frac {\cos a-\cos b\ \cos c}{\sin b\ \sin c}}\right),$
$\beta =\arccos \left({\frac {\cos b-\cos c\ \cos a}{\sin c\ \sin a}}\right),$
$\gamma =\arccos \left({\frac {\cos c-\cos a\ \cos b}{\sin a\ \sin b}}\right).$

### Two sides and the included angle given (spherical SAS)

Known: the sides a, b and the angle γ between them. The side c can be found from the spherical law of cosines:

$c=\arccos \left(\cos a\cos b+\sin a\sin b\cos \gamma \right).$

The angles α, β can be calculated as above, or by using Napier's analogies:

$\alpha =\arctan \ {\frac {2\sin a}{\tan({\frac {\gamma }{2}})\sin(b+a)+\cot({\frac {\gamma }{2}})\sin(b-a)}},$
$\beta =\arctan \ {\frac {2\sin b}{\tan({\frac {\gamma }{2}})\sin(a+b)+\cot({\frac {\gamma }{2}})\sin(a-b)}}.$

This problem arises in the navigation problem of finding the great circle between two points on the earth specified by their latitude and longitude; in this application, it is important to use formulas which are not susceptible to round-off errors. For this purpose, the following formulas (which may be derived using vector algebra) can be used:

{\begin{aligned}c&=\arctan {\frac {\sqrt {(\sin a\cos b-\cos a\sin b\cos \gamma )^{2}+(\sin b\sin \gamma )^{2}}}{\cos a\cos b+\sin a\sin b\cos \gamma }},\\\alpha &=\arctan {\frac {\sin a\sin \gamma }{\sin b\cos a-\cos b\sin a\cos \gamma }},\\\beta &=\arctan {\frac {\sin b\sin \gamma }{\sin a\cos b-\cos a\sin b\cos \gamma }},\end{aligned}}

where the signs of the numerators and denominators in these expressions should be used to determine the quadrant of the arctangent.

### Two sides and non-included angle given (spherical SSA)

This problem is not solvable in all cases; a solution is guaranteed to be unique only if the side length adjacent to the angle is shorter than the other side length. Known: the sides b, c and the angle β not between them. A solution exists if the following condition holds:

$b>\arcsin(\sin c\,\sin \beta ).$

The angle γ can be found from the spherical law of sines:

$\gamma =\arcsin \left({\frac {\sin c\,\sin \beta }{\sin b}}\right).$

As for the plane case, if b < c then there are two solutions: γ and 180° - γ.

We can find other characteristics by using Napier's analogies:

{\begin{aligned}a&=2\arctan \left[\tan \left({\tfrac {1}{2}}(b-c)\right){\frac {\sin \left({\tfrac {1}{2}}(\beta +\gamma )\right)}{\sin \left({\tfrac {1}{2}}(\beta -\gamma )\right)}}\right],\\[4pt]\alpha &=2\operatorname {arccot} \left[\tan \left({\tfrac {1}{2}}(\beta -\gamma )\right){\frac {\sin \left({\tfrac {1}{2}}(b+c)\right)}{\sin \left({\tfrac {1}{2}}(b-c)\right)}}\right].\end{aligned}}

### A side and two adjacent angles given (spherical ASA)

Known: the side c and the angles α, β. First we determine the angle γ using the spherical law of cosines:

$\gamma =\arccos(\sin \alpha \sin \beta \cos c-\cos \alpha \cos \beta ).\,$

We can find the two unknown sides from the spherical law of cosines (using the calculated angle γ):

$a=\arccos \left({\frac {\cos \alpha +\cos \beta \cos \gamma }{\sin \beta \sin \gamma }}\right),$
$b=\arccos \left({\frac {\cos \beta +\cos \alpha \cos \gamma }{\sin \alpha \sin \gamma }}\right),$

or by using Napier's analogies:

{\begin{aligned}a&=\arctan \left[{\frac {2\sin \alpha }{\cot({\frac {c}{2}})\sin(\beta +\alpha )+\tan({\frac {c}{2}})\sin(\beta -\alpha )}}\right],\\[4pt]b&=\arctan \left[{\frac {2\sin \beta }{\cot({\frac {c}{2}})\sin(\alpha +\beta )+\tan({\frac {c}{2}})\sin(\alpha -\beta )}}\right].\end{aligned}}

### A side, one adjacent angle and the opposite angle given (spherical AAS)

Known: the side a and the angles α, β. The side b can be found from the spherical law of sines:

$b=\arcsin \left({\frac {\sin a\,\sin \beta }{\sin \alpha }}\right).$

If the angle for the side a is acute and α > β, another solution exists:

$b=\pi -\arcsin \left({\frac {\sin a\,\sin \beta }{\sin \alpha }}\right).$

We can find other characteristics by using Napier's analogies:

{\begin{aligned}c&=2\arctan \left[\tan \left({\tfrac {1}{2}}(a-b)\right){\frac {\sin \left({\tfrac {1}{2}}(\alpha +\beta )\right)}{\sin \left({\frac {1}{2}}(\alpha -\beta )\right)}}\right],\\[4pt]\gamma &=2\operatorname {arccot} \left[\tan \left({\tfrac {1}{2}}(\alpha -\beta )\right){\frac {\sin \left({\tfrac {1}{2}}(a+b)\right)}{\sin \left({\frac {1}{2}}(a-b)\right)}}\right].\end{aligned}}

### Three angles given (spherical AAA)

Known: the angles α, β, γ. From the spherical law of cosines we infer:

$a=\arccos \left({\frac {\cos \alpha +\cos \beta \cos \gamma }{\sin \beta \sin \gamma }}\right),$
$b=\arccos \left({\frac {\cos \beta +\cos \gamma \cos \alpha }{\sin \gamma \sin \alpha }}\right),$
$c=\arccos \left({\frac {\cos \gamma +\cos \alpha \cos \beta }{\sin \alpha \sin \beta }}\right).$

### Solving right-angled spherical triangles

The above algorithms become much simpler if one of the angles of a triangle (for example, the angle C) is the right angle. Such a spherical triangle is fully defined by its two elements, and the other three can be calculated using Napier's Pentagon or the following relations.

$\sin a=\sin c\cdot \sin A$  (from the spherical law of sines)
$\tan a=\sin b\cdot \tan A$
$\cos c=\cos a\cdot \cos b$  (from the spherical law of cosines)
$\tan b=\tan c\cdot \cos A$
$\cos A=\cos a\cdot \sin B$  (also from the spherical law of cosines)
$\cos c=\cot A\cdot \cot B$

## Some applications

### Triangulation

If one wants to measure the distance d from shore to a remote ship via triangulation, one marks on the shore two points with known distance l between them (the baseline). Let α, β be the angles between the baseline and the direction to the ship.

From the formulae above (ASA case, assuming planar geometry) one can compute the distance as the triangle height:

$d={\frac {\sin \alpha \,\sin \beta }{\sin(\alpha +\beta )}}\ell ={\frac {\tan \alpha \,\tan \beta }{\tan \alpha +\tan \beta }}\ell .$

For the spherical case, one can first compute the length of side from the point at α to the ship (i.e. the side opposite to β) via the ASA formula

$\tan b={\frac {2\sin \beta }{\cot(l/2)\sin(\alpha +\beta )+\tan(l/2)\sin(\alpha -\beta )}},$

and insert this into the AAS formula for the right subtriangle that contains the angle α and the sides b and d:

$\sin d=\sin b\sin \alpha ={\frac {\tan b}{\sqrt {1+\tan ^{2}b}}}\sin \alpha .$

(The planar formula is actually the first term of the Taylor expansion of d of the spherical solution in powers of l.)

This method is used in cabotage. The angles α, β are defined by observation of familiar landmarks from the ship.

As another example, if one wants to measure the height h of a mountain or a high building, the angles α, β from two ground points to the top are specified. Let be the distance between these points. From the same ASA case formulas we obtain:

$h={\frac {\sin \alpha \,\sin \beta }{\sin(\beta -\alpha )}}\ell ={\frac {\tan \alpha \,\tan \beta }{\tan \beta -\tan \alpha }}\ell .$

### The distance between two points on the globe

To calculate the distance between two points on the globe,

Point A: latitude λA, longitude LA, and
Point B: latitude λB, longitude LB

we consider the spherical triangle ABC, where C is the North Pole. Some characteristics are:

$a=90^{\mathrm {o} }-\lambda _{\mathrm {B} },\,$
$b=90^{\mathrm {o} }-\lambda _{\mathrm {A} },\,$
$\gamma =L_{\mathrm {A} }-L_{\mathrm {B} }.\,$

If two sides and the included angle given, we obtain from the formulas

$\mathrm {AB} =R\arccos \left[\sin \lambda _{\mathrm {A} }\,\sin \lambda _{\mathrm {B} }+\cos \lambda _{\mathrm {A} }\,\cos \lambda _{\mathrm {B} }\,\cos \left(L_{\mathrm {A} }-L_{\mathrm {B} }\right)\right].$

Here R is the Earth's radius.