A circle of radius 1 is inscribed inside a regular octagon (a polygon with eight sides of length b). Calculate the octagon’s perimeter and its area. 
A circle of radius 1 is inscribed inside a regular octagon (a polygon with eight sides of length b). Calculate the octagon’s perimeter and its area.
Hint: Split the octagon into eight isosceles triangles.

What I did is divide the entire circle into 16 parts like the following:

Side A has length 1.
Side C has a length of 1 + x (x being the difference between the circle and the vertex of the octagon).
Side B has length b/2.
Angle AC is $\frac{360}{12}=22.5$.
Angle AB is 90 degrees.
Angle BC is 67.5 degrees.
I know that
$\tan{(22.5)}=\frac{b}{2}\times\frac{1}{1}$
The perimeter then is 16 times $\frac{b}{2}:
$16\times2\tan{(22.5)}=P_b$
$32\tan{(22.5)}=P_b$
However, the answer in the textbook is:

What am I doing wrong?
 A: To add onto @JoshuaWang, tan($22.5^o$)=tan$\frac{\frac π4}{2}$
Then using the half angle formula for tangent which can be found from the sine and cosine half angle formulas:
$tan^2\frac π8$= $\frac{1-cos(π/4)}{1+cos(π/4)}$=$\frac{1-\frac{1}{\sqrt 2}}{1+\frac{1}{\sqrt 2}}$= $\frac{\frac{\sqrt2}{\sqrt2}-\frac{1}{\sqrt 2}}{\frac{\sqrt2}{\sqrt2}+\frac{1}{\sqrt 2}}$=$\frac{\sqrt2-1}{\sqrt2+1}$*$\frac{\sqrt2-1}{\sqrt2-1}$
Which simplifies to the the original numerator squared divided by original denominator multiplied by its conjugate:
$\frac{3-2\sqrt2}{\sqrt2 ^2-1^2}$=$3-2\sqrt2$
Taking the positive square root gets us tan$\frac π8$=$ \sqrt {3-2\sqrt2}$.
Then let tan$\frac π8$=$\sqrt c$=$\sqrt a\pm\sqrt b$→$\sqrt c ^2$=$(\sqrt a\pm\sqrt b)^2$=$a+b\pm2\sqrt {ab}$= $3-2\sqrt2$.
Then, in order to simplify the nested square roots, the system of equations has to be solved from the last part of the previous step. It would be easier to use the negative branch:
$a+b-\sqrt {ab}$= $3-2\sqrt2$⇔
a+b=3
$\sqrt {ab}=\sqrt2$
Solving this gets us that a=2 and b=1:
tan $\frac π8$=$tan22.5^o$=$\sqrt{3-2\sqrt2}$=$\sqrt2-1$.
In conclusion:
P=8($\sqrt2-1$)=8 $\sqrt2-8$,A=16 ($\sqrt2-1$)=16 $\sqrt2-16$
A: Note that $\frac{\frac{b}{2}}{1} = \tan(22.5^{\circ})$. Then, $b = 2\tan(22.5^{\circ})$, so $\boxed{P = 16\tan(22.5^{\circ}).}$ Also, since $b = 2\tan(22.5^{\circ})$, the area of one of the isosceles triangles is $\frac{b}{2} = \tan(22.5^{\circ})$. Thus, $\boxed{A = 8\tan(22.5^{\circ}).}$
