What am I supposed to do here now? $\tan(\pi/8) = \sqrt{2} -1$ complex analysis 
Find $\sqrt{1+i}$, and hence show $\tan(\pi/8) = \sqrt{2}-1$

Okay so I know that $\sqrt{1+i} = 2^{1/4}e^{i\pi/8}$ and I know $\sin x = \frac{e^{ix} - e^{-ix}}{2i}$ and $\cos x = \frac{e^{ix} + e^{-ix}}{2}$
If i directly substitute those definitions of sine and cosine into $$\tan(x) = \frac{\sin(x)}{\cos(x)}$$
then I am going to end up with a complex number in the form of $x + iy$. My key says 
$$\tan \pi/8 = \sqrt{\frac{\sqrt{2}-1}{\sqrt{2}+1}} = \sqrt{2}-1.$$
Did they just use $\Re(\tan \pi/ 8) = \frac{\Re (\sin )}{\Re \cos}$?
 A: If you let $$\sqrt{1+i}=x+iy$$, then $$(x^2-y^2)+i2xy=1+i$$. then $$x^2-y^2=1$$ and $$2xy=1$$. Hence $$(x^2+y^2)^2=(x^2-y^2)^2+4x^2y^2=2$$. Hence $$x^2+y^2=\sqrt{2}$$. Now adding this two terms $$x^2=\frac{1+\sqrt{2}}{2}$$ and $$y^2=\frac{\sqrt{2}-1}{2}$$. So $$\sqrt{1+i} =\sqrt{\frac{1+\sqrt{2}}{2}}+i\sqrt{\frac{\sqrt{2}-1}{2}}$$
You already have $$\sqrt{1+i} = 2^{1/4}e^{i\pi/8}=2^{\frac{1}{4}}\left(\cos \frac{2\pi}{8}+ i\sin \frac{2 \pi}{8}\right)$$
Comparing both these $$\cos \frac{ \pi}{8}=\frac{1}{2^{\frac{1}{4}}}\sqrt{\frac{\sqrt{2}+1}{2}}$$ and $$\sin \frac{ \pi}{8}=\frac{1}{2^{\frac{1}{4}}}\sqrt{\frac{\sqrt{2}-1}{2}}$$
Then you have your answer
A: You can work it out by rationalizing *
You can use a half-angle formula for Tan, i.e., a formula for Tan(B/2)
$tan(B/2)  =  (1 − cos B) / sin B  =  sin B / (1 + cos B)$
For CosB=SinB =$\sqrt \frac{2}{2}$, then , $Tan \pi/8= \frac{\frac{\sqrt{2}}{2}}{1+\frac{\sqrt{2}}{2}}=\frac{\sqrt2}{2+\sqrt2}=\frac{2\sqrt2-2}{2}=\sqrt{2}-1$
If you want to arrive at the actual values of $\sqrt{2}-1, \sqrt{2}+1$ for sin, cos, you can use DeMoivre's theorem:
$(Cos\theta+iSin\theta)^{1/2}=(Cos\theta/2+ iSin \theta/2)$, and then you can use half-angle formulas for each of sine and cosine:
$cos(B/2) = ± \sqrt{([1 + cos B] / 2)}$
$Sin(B/2) = ±\sqrt{([1 - cos B] / 2})$
And in this case, $SinB=CosB= \frac{\sqrt{2}}{2}$
