sin(π/6)=½, and if we draw a right triangle with hypotenuse length 2 and the side opposite to the angle of π/6 (=30°) has length 1, then the remaining side has length √(22-12)=√3 (Pythagoras) so tan(π/6)=1/√3.
Let t=tan(π/12), then, because tan(2t)=tan(π/6)=2t/(1-t2)=1/√3, so 1-t2=2t√3, t2+2t√3=1. Completing the square: t2+2t√3+3=4, (t+√3)2=4, t+√3=±2, and t=-√3±2. There are two solutions for t because tangent has the same value in two different quadrants. If we keep in the first quadrant, then we must use the positive solution t=2-√3.
Now let t=π/24=½(π/12), we can write tan(π/12)=2t/(1-t2)=2-√3,
1-t2=2t/(2-√3)=2t(2+√3), t2+2t(2+√3)=1. Completing the square:
t2+2t(2+√3)+(2+√3)2=1+(2+√3)2=1+4+4√3+3=8+4√3=4(2+√3).
(t+2+√3)2=4(2+√3), t+2+√3=2√(2+√3).
Let a+b√3=√(2+√3), then a2+3b2+2ab√3=2+√3, so a2+3b2=2, 2ab=1, b=1/2a.
a2+3b2=a2+3/(4a2)=2, 4a4+3=8a2, 4a4-8a2+3=(2a2-3)(2a-1)=0, so a2=3/2 or 1/2. b2=1/(4a2)=1/6 or 1/2.
Therefore (a,b)=(√(3/2),1/√6) or (1/√2,1/√2). We need to find out which is correct:
(a,b)=(√(3/2),1/√6): a2+3b2=3/2+3/6=2 (correct!);
(a,b)=(1/√2,1/√2): a2+3b2=1/2+3/2=2 (correct!).
So t+2+√3=2(a+b√3)=2(√(3/2)+√3/√6) or 2(1/√2+(1/√2)√3). These are two expressions for the same quantity: 2(√(3/2)+1/√2)=√6+√2.
Therefore: t+2+√3=√6+√2, t=tan(π/24)=√6+√2-2-√3. cot(π/24)=1/t=1/(√6+√2-2-√3). Multiply top and bottom by (√6+√2+2+√3):
(√6+√2+2+√3)/((√6+√2)2-(2+√3)2)=(√6+√2+2+√3)/(6+2+2√12-4-3-4√3)=
(√6+√2+2+√3)/(1+4√3-4√3)=√6+√2+2+√3=√2+√3+√4+√6 QED