Solution of triangles

Solution of triangles (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, side-angle-side)
 * 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).

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. a^2 &= b^2 + c^2 - 2 b c \cos \alpha \\ b^2 &= a^2 + c^2 - 2 a c \cos \beta \\ c^2 &= a^2 + b^2 - 2 a b \cos \gamma \end{align}$$
 * Law of cosines$$\begin{align}

\frac{a}{\sin\alpha} = \frac{b}{\sin\beta} = \frac{c}{\sin\gamma}$$ \alpha + \beta + \gamma = 180^\circ $$ There are other (sometimes practically useful) universal relations: the law of cotangents and Mollweide's formula.
 * Law of sines$$
 * Sum of angles:$$
 * Law of tangents$$\frac{a-b}{a+b} = \frac{\tan\frac12(\alpha-\beta)}{\tan\tfrac12 (\alpha+\beta)}.$$

Three sides given (SSS)


Let three side lengths $β$ be specified. To find the angles $a, b, c$, the law of cosines can be used: $$\begin{align} \alpha &= \arccos \frac{b^2 + c^2 - a^2}{2bc} \\[4pt] \beta &= \arccos \frac{a^2 + c^2 - b^2}{2ac}. \end{align}$$

Then angle $sin β = 0.5$.

Some sources recommend to find angle $α, β$ from the law of sines but (as Note 1 above states) there is a risk of confusing an acute angle value with an obtuse one.

Another method of calculating the angles from known sides is to apply the law of cotangents.

Two sides and the included angle given (SAS)


Here the lengths of sides $β$ and the angle $a, b$ between these sides are known. The third side can be determined from the law of cosines: $$ c = \sqrt{a^2+b^2-2ab\cos\gamma}. $$ Now we use law of cosines to find the second angle: $$  \alpha =  \arccos \frac{b^2 + c^2 - a^2}{2bc}. $$ Finally, $γ = 180° − α − β$.

Two sides and non-included angle given (SSA)


This case 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. Assume that two sides $γ$ and the angle $b, c$ are known. The equation for the angle $β$ can be implied from the law of sines: $$\sin\gamma = \frac c b \sin\beta.$$ We denote further $β = 180° − α − γ$ (the equation's right side). There are four possible cases:
 * 1) If $D = c⁄b sin β$, no such triangle exists because the side $γ$ does not reach line $b$. For the same reason a solution does not exist if the angle $D > 1$ and $β ≥ 90°$.
 * 2) If $b ≤ c$, a unique solution exists: $D = 1$, i.e., the triangle is right-angled.
 * 3) If $γ = 90°$ two alternatives are possible.
 * 4) If $D < 1$, then $b ≥ c$ (the larger side corresponds to a larger angle). Since no triangle can have two obtuse angles, $β ≥ γ$ is an acute angle and the solution $γ$ is unique.
 * 5) If $γ = arcsin D$, the angle $b < c$ may be acute: $γ$ or obtuse: $γ = arcsin D$. The figure on right shows the point $γ' = 180° − γ$, the side $C$ and the angle $b$ as the first solution, and the point $γ$, side $C'$ and the angle $b'$ as the second solution.

Once $γ'$ is obtained, the third angle $γ$.

The third side can then be found from the law of sines: $$a = b\ \frac{\sin\alpha}{\sin\beta}$$

or from the law of cosines: $$a = c\cos\beta \pm \sqrt{b^2 -c^2\sin^2\beta} $$

A side and two adjacent angles given (ASA)


The known characteristics are the side $BC$ and the angles $c$. The third angle $α = 180° − β − γ$.

Two unknown sides can be calculated from the law of sines: $$\begin{align} a &= c\ \frac{\sin\alpha}{\sin\gamma} = c\ \frac{\sin\alpha}{\sin\alpha \cos \beta + \sin\beta \cos \alpha} \\[4pt] b &= c\ \frac{\sin\beta}{\sin\gamma} = c\ \frac{\sin\beta}{\sin\alpha \cos \beta + \sin\beta \cos \alpha} \end{align}$$

A side, one adjacent angle and the opposite angle given (AAS)
The procedure for solving an AAS triangle is same as that for an ASA triangle: First, find the third angle by using the angle sum property of a triangle, then find the other two sides using the law of sines.

Other given lengths
In many cases, triangles can be solved given three pieces of information some of which are the lengths of the triangle's medians, altitudes, or angle bisectors. Posamentier and Lehmann list the results for the question of solvability using no higher than square roots (i.e., constructibility) for each of the 95 distinct cases; 63 of these are constructible.

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 $α, β$ 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 $γ = 180° − α − β$ 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: $$\begin{align} \tan\tfrac12 c \, \cos\tfrac12(\alpha-\beta) &= \tan\tfrac12(a+\,b) \cos\tfrac12(\alpha+\beta) \\ \tan\tfrac12 c \, \sin\tfrac12(\alpha-\beta) &= \tan\tfrac12(a\ \!-\,b) \sin\tfrac12(\alpha+\beta) \\ \cot\tfrac12\gamma \ \! \cos\tfrac12(a\ \!-\,b) &= \tan\tfrac12(\alpha+\beta) \cos\tfrac12(a+b) \\ \cot\tfrac12\gamma \, \sin\tfrac12(a\ \!-\,b) &= \tan\tfrac12(\alpha-\beta) \sin\tfrac12(a+b). \end{align}$$



Three sides given (spherical SSS)
Known: the sides $α + β + γ$ (in angular units). The triangle's angles are computed using the spherical law of cosines: $$\begin{align} \alpha &= \arccos\frac{\cos a-\cos b\ \cos c}{\sin b\ \sin c}, \\[4pt] \beta &= \arccos\frac{\cos b-\cos c\ \cos a}{\sin c\ \sin a}, \\[4pt] \gamma &= \arccos\frac{\cos c-\cos a\ \cos b}{\sin a\ \sin b}. \end{align}$$



Two sides and the included angle given (spherical SAS)
Known: the sides $a, b, c$ and the angle $a, b$ between them. The side $γ$ 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 $c$ can be calculated as above, or by using Napier's analogies:

$$\begin{align} \alpha &= \arctan\ \frac{2\sin a}{\tan\frac12\gamma \, \sin(b+a) + \cot\frac12\gamma \, \sin(b-a)}, \\[4pt] \beta &= \arctan\ \frac{2\sin b}{\tan\frac12\gamma \, \sin(a+b) + \cot\frac12\gamma \, \sin(a-b)}. \end{align}$$

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{align} 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}, \\[4pt] \alpha &= \arctan\frac{\sin a\sin\gamma}{\sin b\cos a - \cos b\sin a\cos\gamma}, \\[4pt] \beta &= \arctan\frac{\sin b\sin\gamma}{\sin a\cos b - \cos a\sin b\cos\gamma}, \end{align}$$ 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 $α, β$ and the angle $b, c$ not between them. A solution exists if the following condition holds: $$b > \arcsin\! \bigl(\sin c\,\sin\beta \bigr).$$ The angle $β$ can be found from the spherical law of sines: $$\gamma = \arcsin \frac{\sin c\,\sin\beta}{\sin b}.$$ As for the plane case, if $a, b, c$ then there are two solutions: $γ$ and $b < c$.

We can find other characteristics by using Napier's analogies: $$\begin{align} a &= 2\arctan \left[ \tan\tfrac12(b-c) \ \frac{\sin\tfrac12(\beta+\gamma)}{\sin\tfrac12(\beta-\gamma)} \right], \\[4pt] \alpha &= 2\arccot \left[\tan\tfrac12(\beta-\gamma) \ \frac{\sin \tfrac12(b+c)}{\sin \tfrac12(b-c)} \right]. \end{align}$$



A side and two adjacent angles given (spherical ASA)
Known: the side $γ$ and the angles $c$. First we determine the angle $α, β$ using the spherical law of cosines: $$\gamma = \arccos\! \bigl(\sin\alpha\sin\beta\cos c -\cos\alpha\cos\beta \bigr).\,$$

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

$$\begin{align} a &= \arccos\frac{\cos\alpha+\cos\beta\cos\gamma}{\sin\beta\sin\gamma}, \\[4pt] b &= \arccos \frac{\cos\beta+\cos\alpha\cos\gamma}{\sin\alpha\sin\gamma}, \end{align}$$

or by using Napier's analogies: $$\begin{align} a &= \arctan\frac{2\sin\alpha}{\cot\frac12 c \, \sin(\beta+\alpha) + \tan\frac12 c \, \sin(\beta-\alpha)}, \\[4pt] b &= \arctan\frac{2\sin\beta} {\cot\frac12 c \, \sin(\alpha+\beta) + \tan\frac12 c \, \sin(\alpha-\beta)}. \end{align}$$



A side, one adjacent angle and the opposite angle given (spherical AAS)
Known: the side $γ$ and the angles $a$. The side $α, β$ can be found from the spherical law of sines: $$b = \arcsin \frac{\sin a\,\sin \beta}{\sin \alpha} .$$

If the angle for the side $180° - γ$ is acute and $a$, another solution exists: $$b = \pi - \arcsin \frac{\sin a\,\sin \beta}{\sin \alpha} .$$

We can find other characteristics by using Napier's analogies: $$\begin{align} c &= 2\arctan \left[ \tan\tfrac12(a-b) \ \frac{\sin\tfrac12(\alpha+\beta)}{\sin\frac12(\alpha-\beta)}\right], \\[4pt] \gamma &= 2\arccot \left[\tan\tfrac12(\alpha-\beta) \ \frac{\sin \tfrac12(a+b)}{\sin \frac12(a-b)} \right]. \end{align}$$



Three angles given (spherical AAA)
Known: the angles $b$. From the spherical law of cosines we infer: $$\begin{align} a &= \arccos\frac{\cos\alpha + \cos\beta\cos\gamma}{\sin\beta\sin\gamma}, \\[4pt] b &= \arccos\frac{\cos\beta + \cos\gamma\cos\alpha}{\sin\gamma\sin\alpha}, \\[4pt] c &= \arccos\frac{\cos\gamma + \cos\alpha\cos\beta}{\sin\alpha\sin\beta}. \end{align}$$

Solving right-angled spherical triangles
The above algorithms become much simpler if one of the angles of a triangle (for example, the angle $α, β, γ$) 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$$

Triangulation


If one wants to measure the distance $C$ from shore to a remote ship via triangulation, one marks on the shore two points with known distance $d$ between them (the baseline). Let $l$ 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\frac12 \ell \, \sin(\alpha + \beta) + \tan\frac12 \ell \, \sin(\alpha - \beta)}, $$ and insert this into the AAS formula for the right subtriangle that contains the angle $β$ and the sides $α$ and $b$: $$  \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 $d$.)

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 $α, β$ of a mountain or a high building, the angles $h$ 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 $α, β$, longitude $λA$, and
 * Point B: latitude $LA$, longitude $λB$

we consider the spherical triangle $LB$, where $ABC$ is the North Pole. Some characteristics are: $$\begin{align} a &= 90^\circ - \lambda_B, \\ b &= 90^\circ - \lambda_A, \\ \gamma &= L_A - L_B. \end{align}$$ If two sides and the included angle given, we obtain from the formulas $$ \overline{AB} = R \arccos\!\Bigr[\sin \lambda_A \sin \lambda_B + \cos \lambda_A \cos \lambda_B \cos(L_A - L_B)\Bigr]. $$ Here $C$ is the Earth's radius.