Consider an isosceles triangle $ABC$, having its vertex angle $\hat{C}$ equal to $\pi/5$, so the base angles $\hat{A}$ and $\hat{B}$ are $2\pi/5$. Draw the bisector of angle $\hat{B}$ meeting $AC$ in $D$.
Then the triangle $ADB$ is similar to $ABC$. Call $l$ the length of $AC$ and $x$ the length of $AB$. Then $BD$ and $DC$ also have length $x$ and $l\cos2\pi/5=x/2$.
By the similarity, we have
$$
\frac{l}{x}=\frac{x}{l-x}
$$
so
$$
l^2-lx=x^2
$$
and, easily,
$$
x=\frac{\sqrt{5}-1}{2}l
$$
(the negative root must be discarded, of course). Thus
$$
\cos\frac{2\pi}{5}=\frac{\sqrt{5}-1}{4}
$$
and it's easy to compute $\sin(\pi/5)$ and $\cos(\pi/5)$ from this.
One can use the outlined strategy, too. The key is using $\pi/10$ and not $x=\pi/5$. If $x=\pi/10$, then
$$
\frac{\pi}{2}-3x=\frac{5\pi}{10}-\frac{3\pi}{10}=\frac{2\pi}{10}=2x
$$
and therefore
$$
\tan3x=\tan\left(\frac{\pi}{2}-2x\right)=\cot2x=\frac{1}{\tan2x}
$$
Now we can apply the formulas and get
$$
\frac{3\tan x-\tan^3x}{1-3\tan^2x}=\frac{1-\tan^2x}{2\tan x}
$$
or, setting $t=\tan x$,
$$
6t^2-2t^4=1-3t^2-t^2+3t^4
$$
that reduces to
$$
5t^4-10t^2+1=0
$$
This gives
$$
t^2=\frac{5+2\sqrt{5}}{5}
$$
But $\tan(\pi/5)=\tan2x$ or
$$
\tan\frac{\pi}{5}=\frac{2t}{1-t^2}
$$
and just substituting will give the result.
There is a simple way to take the mean of two angles $\alpha$ and $\beta$
with the result as a positive normalized angle:
$$ \gamma = g \left(\alpha + \frac 12 f(\beta - \alpha)\right),$$
where $f(\theta) = \theta + 2n\pi \in (-\pi,\pi]$ with $n\in \mathbb Z$
is the function that normalizes angles to the smallest magnitude and
$g(\theta) = \theta + 2n\pi \in [0,2\pi)$ with$n\in \mathbb Z$
is the function that normalizes angles to the smallest positive value.
If you are using degree measure, of course, the functions are
$f(\theta) = \theta + 360n \in (-180,180]$
and $g(\theta) = \theta + 360n \in [0,360)$.
In these formulas the style of brackets at each end of the specified range of
angles tells you whether each endpoint is included (square bracket) or not
included (round bracket) in the range; for example,
$f(\theta) \in (-180,180]$ means $-180 < f(\theta) \leq 180.$
In any case, the value $n$ is whatever integer value will put the function value
in the desired range; working in degrees, $f(370) = 370 + 360(-1) = 10,$
that is, in that case $n = -1$,
but $f(20) = 20 + 360(0) = 20,$ that is, $n = 0$ in that case.
The "normalization functions" in that formula are discontinuous sawtooth-pattern
functions. They're not necessarily suitable for all applications, but when you
just need to bisect an angle they can be very handy.
If you start with the assumption that both angles $\alpha$ and $\beta$ are already
normalized, then the angle values of your intermediate results will never fall
outside the range $(-2\pi,2\pi)$ radians or $(-360,360)$ degrees for $f$
and will never be outside $\left(-\frac\pi2,\frac32\pi\right]$ radians or $(-180,540]$ degrees for $g$, and you can use these versions of the functions for radians:
$$ f(\theta) = \begin{cases}
\theta + 2\pi & \mbox{if}\quad \theta \leq -\pi \\
\theta & \mbox{if}\quad {-\pi} < \theta \leq \pi \\
\theta - 2\pi & \mbox{if}\quad \theta > \pi \\
\end{cases}$$
$$ g(\theta) = \begin{cases}
\theta + 2\pi & \mbox{if}\quad \theta < 0 \\
\theta & \mbox{if}\quad 0 \leq \theta < 2\pi \\
\theta - 2\pi & \mbox{if}\quad \theta \geq 2\pi \\
\end{cases}$$
For angles in degrees, of course, substitute $180$ for $\pi$.
The formula
$$ \gamma = \arctan\left(\frac{\sin\alpha +\sin\beta}{\cos\alpha +\cos\beta}\right) $$
is based on taking the sum of two unit vectors, $(\sin\alpha, \cos\alpha)$
and $(\sin\beta, \cos\beta)$. As observed, it can run into trouble if you
do not account for the components of both vectors individually.
But it also has another drawback: it gives results only in the range
$(-\frac\pi2,\frac\pi2)$ (or $(-180,180)$ in degrees).
You cannot use it to "average" the angles $90$ and $100$ because it will give you
$-85$ instead of $95$, and you cannot use it to average $80$ and $100$ because
it will not give you any answer at all
(since you cannot take the tangent of a right angle).
A function that actually works for all angles is the atan2
function,
which is like arctan except that it requires two input parameters instead of one
and gives a result in the range $(-\pi,\pi]$:
$$ \gamma = \mbox{atan2}(\sin\alpha +\sin\beta, \cos\alpha +\cos\beta).$$
Best Answer
Hint
Use the formula $\tan(a+b)=\frac{\tan(a)+\tan(b)}{1-\tan(a)\tan(b)}$