<s>[INST] Finding $\tan \pi/8$ from $\sqrt{1+i}$. I want to prove that $\tan \pi/8 = \sqrt{2} - 1$ using $\sqrt{1+i}$ in some way.
Write: $\sqrt{1+i} = a+bi$, and let's find $a$ and $b$. We have: $$1+i = a^2+b^2 + 2abi,$$ so $a^2+b^2 = 1$ and $ab = 1/2$. This already seems wrong to me, because we know that $|1+i| = \sqrt{2} \implies |\sqrt{1+i}| = \sqrt[4]{2},$ regardless of what root we choose. Let's pretend everything is ok. Substituition gives $$a^2 + \frac{1}{4a^2} = 1 \implies a^4 - a^2 + \frac{1}{4} = 0 \implies a^2 = \frac{1}{2} \implies a = \pm \frac{\sqrt{2}}{2},$$ and $$b = \pm\frac{1}{2\frac{\sqrt{2}}{2}} = \pm\frac{\sqrt{2}}{2} = a.$$ 
And writing $1+i = re^{i((\pi/4)+2k\pi)}$, we get the roots are given by $\sqrt[4]{2}e^{i((\pi/8)+k\pi)}$.
Now, $z = x+iy \implies \tan \arg(x+iy) = y/x$ would give us $\tan \pi/8 = 1$!
Can someone give me a light here? It must be simple, but I'm failing to make sense of this. Thanks.

Yes, I know better ways to find $\tan \pi/8$. I want to do it this way.
 [/INST] I've got it figured out. Silly mistake, as always. I should have $$1+i = a^2 - b^2 +  2abi,$$ as pointed by Omnomnomnom in the comments. Then: $$\begin{cases} a^2 - b^2 = 1 \\ ab = 1/2\end{cases} \implies a^2 - \frac{1}{4a^2} = 1 \implies a^4 - a^2 - \frac{1}{4} = 1,$$ so: $$a^2 = \frac{1\pm \sqrt{2}}{2} \implies a = \pm \sqrt{\frac{1+\sqrt{2}}{2}},$$ since $a$ must be real. Then: $$b = \pm\frac{1}{2\sqrt{\frac{1+\sqrt{2}}{2}}} \implies b = \pm\frac{1}{\sqrt{2}\sqrt{\sqrt{2}+1}}.$$
Finally, $$\tan \pi/8 = \frac{b}{a} = \pm\frac{1}{\sqrt{2}\sqrt{\sqrt{2}+1}}\frac{\pm \sqrt{2}}{\sqrt{\sqrt{2}+1}} = \frac{1}{\sqrt{2}+1} = \sqrt{2}-1.$$
</s>