# Length of angle bisector in a regular polygon?

How can I find a relation describing the length of angle bisector of regular polygon expressed as a function of its side's length?

For a equilateral triangle and a square with a side of length $a$, the relations are:

$t_{a} = \frac{a \sqrt{3}}{2}$

and

$t_{a} = \frac{a \sqrt{2}}{2}$

Could this be generalised to relation describing bisector's length of a regular $N-$ polygon?

The radius of a regular polygon with $n$ sides of length $a$ is $a/\left(2\sin{180^\circ\over n}\right)$ while its apothem is $a/\left(2\tan{180^\circ\over n}\right)$. If $n$ is even, then the bisector $d$ is twice the radius, while if $n$ is odd $d$ is the sum of radius and apothem. This leads to: $$d={a\over\sin(180°/n)},\ \hbox{if n is even;}\qquad d={a\over2}{1+\cos(180°/n)\over\sin(180°/n)},\ \hbox{if n is odd.}$$
I can find the length of a bisector of a polygon using, for example, the Cosine Law and knowing all the angles (two of them are half the angle of the polygon and the third is found form the total sum of $180^{\circ}$) and a side of the isosceles triangle formed by any two bisectors and one of the sides of the regular polygon. But it look ugly:
$b = \sqrt\frac{a}{2(1 - \cos({180(1 -\frac{n -2}{n}})))}$ ,
where $a-$ the side of the polygon, $b-$ the length of the bisector and $n-$ the number of the sides.
There should be something less complex. Additionally I've tried figuring out some pattern by knowing the bisector length of a square ($\frac{a\sqrt{2}}{2}$) along with that of a equilateral triangle, but nothing comes along.