Question 960361
<pre>
Draw angle B in 3rd quadrant:

Since sine = {{{y=r}}}, we make y=-1 and r=5, so that the sin(B)
will be {{{y/r}}}{{{""=""}}}{{{(-1)/5}}}.

{{{drawing(400,2000/9,-6,3,-3,2,
red( locate(-2,1.3,matrix(1,2,angle,B)) ),
locate(-5.95,-.25,y=-1), locate(-2.8,-.5,r=5),
line(-10,0,10,0),line(0,-10,0,10),
line(-sqrt(24),-1,-sqrt(24),0), locate(-3.2,.4,"x=?"),
line(0,0,-sqrt(24),-1), red(arc(0,0,3,-3,0,192)) )}}}

But we want cos(B) which is {{{x/r}}}

Then we find x by the Pythagorean relation: 

{{{x^2+y^2=r^2}}}
{{{x^2+(-1)^2=(5)^2}}}
{{{x^2+1=25}}}
{{{x^2=24}}}
{{{x= "" +- sqrt(24)}}}
{{{x= "" +- sqrt(4*6)}}}
{{{x = "" +- 2sqrt(6)}}}

Since x goes to the left, we know to take the negative
value {{{x = -2sqrt(6)}}}

{{{drawing(400,2000/9,-6,3,-3,2,
red( locate(-2,1.3,matrix(1,2,angle,B)) ),
locate(-5.95,-.25,y=-1), locate(-2.8,-.5,r=5),
line(-10,0,10,0),line(0,-10,0,10),
line(-sqrt(24),-1,-sqrt(24),0), locate(-3.5,.5,x=-2sqrt(6)),
line(0,0,-sqrt(24),-1), red(arc(0,0,3,-3,0,192)) )}}}

So {{{cos(B)}}}{{{""=""}}}{{{x/r}}}{{{""=""}}}{{{(-2sqrt(6))/5}}}{{{""=""}}}{{{-2sqrt(6)/5}}}

Now use the formula

{{{cos(B/2)}}}{{{""=""}}}{{{"" +- sqrt((1 + cos(B)) / 2)}}}

We need to determine whether to use the + or the - sign.

Since B is in the 3rd quadrant,  {{{pi<=B<=3pi/2}}}
                                 {{{pi/2<=B/2=3pi/4}}}

Therefore {{{B/2}}} is in quadrant 2, and the cosine will be
negative, so

{{{cos(B/2)}}}{{{""=""}}}{{{-sqrt((1 + cos(B)) / 2)}}}

{{{cos(B/2)}}}{{{""=""}}}{{{-sqrt((1 + (-2sqrt(6)/5 )) / 2)}}}

Multiply numerator and denominator by 5 to simplify compound fraction:

{{{cos(B/2)}}}{{{""=""}}}{{{-sqrt(  (5 -2sqrt(6) ) / 10)}}}

That is the correct answer, but it has a square root within a square
root, and often such an expression can be simplified to the sum or
difference of two square roots of rational numbers.  Assume rational 
a and b exist so that

{{{-sqrt(  (5 -2sqrt(6) ) / 10)}}}{{{""=""}}}{{{sqrt(a)-sqrt(b)}}}

I will assume a difference since a difference occurs under the square
root.

Square both sides

{{{  (5 -2sqrt(6))  / 10}}}{{{""=""}}}{{{a-2sqrt(ab)+b}}}

Multiply both sides by 10

{{{  5 -2sqrt(6)  }}}{{{""=""}}}{{{10a-20sqrt(ab)+10b}}}

We set rational parts equal and irrational parts equal

{{{5=10a+10b}}},  {{{2sqrt(6)=20sqrt(ab)}}}
{{{1=2a+2b}}},     {{{sqrt(6)=10sqrt(ab)}}}
                {{{6=100ab}}}
                {{{3=50ab}}} 


Solve {{{3=50ab}}} for b, {{{b=3/(50a)}}}
Substitute in 
{{{1=2a+2b}}}
{{{1=2a+2(3/(50a))}}}
{{{1=2a+3/(25a)}}}
 Multiply through by 25a

{{{25a=50a^2+3}}}

{{{0=50a^2-25a+3}}}

{{{0=(10a-3)(5a-1)}}}

{{{a=3/10}}}, {{{a=1/5}}}

Using {{{a=3/10}}}, substitute in

{{{b=3/(50a)}}}
{{{b=3/(50(3/10))=3/(5*3)=1/5}}}

Using {{{a=1/5}}}, substitute in

{{{b=3/(50a)}}}
{{{b=3/(50(1/5))=3/10}}}

So we either have {{{a=3/10}}},{{{b=1/5}}} or {{{a=1/5}}},{{{b=3/10}}}

But since {{{cos(B/2)}}} is negative we must choose
the second answer:

{{{a=1/5}}},{{{b=3/10}}}

So

{{{cos(B/2)}}}{{{""=""}}}{{{-sqrt(  (5 -2sqrt(6) ) / 10)}}}{{{""=""}}}{{{sqrt(a)-sqrt(b)}}}{{{""=""}}}{{{sqrt(1/5)-sqrt(3/10)}}}{{{""=""}}}{{{sqrt(5)/5-sqrt(30)/10}}}

Edwin</pre>