Hansen's problem

]

In trigonometry, Hansen's problem is a problem in planar surveying, named after the astronomer Peter Andreas Hansen (1795–1874), who worked on the geodetic survey of Denmark. There are two known points $A, B$, and two unknown points $P_{1}, P_{2}$. From $P_{1}$ and $P_{2}$ an observer measures the angles made by the lines of sight to each of the other three points. The problem is to find the positions of $P_{1}$ and $P_{2}$. See figure; the angles measured are $(&alpha;_{1}, &beta;_{1}, &alpha;_{2}, &beta;_{2})$.

Since it involves observations of angles made at unknown points, the problem is an example of resection (as opposed to intersection).

Solution method overview
Define the following angles: $$\begin{alignat}{5} \gamma &= \angle P_1 AP_2, &\quad \delta &= \angle P_1BP_2, \\[4pt] \phi &= \angle P_2 AB, &\quad \psi &= \angle P_1 BA. \end{alignat}$$ As a first step we will solve for $&phi;$ and $&psi;$. The sum of these two unknown angles is equal to the sum of $&beta;_{1}$ and $&beta;_{2}$, yielding the equation

$$\phi + \psi = \beta_1 + \beta_2.$$

A second equation can be found more laboriously, as follows. The law of sines yields

$$ \frac{\overline{AB}}{\overline{P_2 B}} = \frac{\sin \alpha_2}{\sin \phi}, \qquad \frac{\overline{P_2 B}}{\overline{P_1 P_2}} = \frac{\sin \beta_1}{\sin \delta}. $$

Combining these, we get

$$ \frac{\overline{AB}}{\overline{P_1 P_2}} = \frac{\sin \alpha_2 \sin \beta_1}{\sin \phi \sin \delta}.$$

Entirely analogous reasoning on the other side yields

$$ \frac{\overline{AB}}{\overline{P_1 P_2}} = \frac{\sin \alpha_1 \sin \beta_2}{\sin \psi \sin \gamma}.$$

Setting these two equal gives

$$ \frac{\sin \phi}{\sin \psi} = \frac{\sin \gamma \sin \alpha_2 \sin \beta_1}{\sin \delta \sin \alpha_1 \sin \beta_2} = k.$$

Using a known trigonometric identity this ratio of sines can be expressed as the tangent of an angle difference:


 * $$\tan \tfrac12(\phi - \psi) = \frac{k-1}{k+1} \tan\tfrac12(\phi + \psi).$$

Where $$k = \frac{\sin \phi}{\sin \psi}.$$

This is the second equation we need. Once we solve the two equations for the two unknowns $&phi;, &psi;$, we can use either of the two expressions above for $$\tfrac{\overline{AB}}{\overline{P_1 P_2}}$$ to find $\overline{P_1P_2}$ since $\overline{AB}$ is known. We can then find all the other segments using the law of sines.

Solution algorithm
We are given four angles $(α_{1}, β_{1}, α_{2}, β_{2})$ and the distance $\overline{AB}$. The calculation proceeds as follows:

\gamma &= \pi-\alpha_1-\beta_1-\beta_2, \\ \delta &= \pi-\alpha_2-\beta_1-\beta_2. \end{align}$$ k = \frac{\sin \gamma \sin \alpha_2 \sin \beta_1}{\sin \delta \sin \alpha_1 \sin \beta_2}. $$ s = \beta_1+\beta_2, \quad d = 2 \arctan \left( \frac{k-1}{k+1} \tan\tfrac12 s \right) $$ and then $$ \phi = \frac{s+d}{2}, \quad \psi = \frac{s-d}{2}. $$ $$ or equivalently $$ \overline{P_1 P_2} = \overline{AB} \ \frac{\sin \psi \sin \gamma}{\sin \alpha_1 \sin \beta_2}. $$ If one of these fractions has a denominator close to zero, use the other one.
 * Calculate $$\begin{align}
 * Calculate $$
 * Let $$
 * Calculate $$\overline{P_1 P_2} = \overline{AB} \ \frac{\sin \phi \sin \delta}{\sin \alpha_2 \sin \beta_1}