In the diagram above, a regular octagon is shown nested inside square LMNP. The central angles of this octagon, such as angle HAF, each measure 360/8 = 45 degrees. Segments HA and FA are radii, and G is the midpoint of HF, making GF a half-side and GA an apothem. Since this apothem bisects angle HAF, angle GAF is 22.5 degrees, making the yellow triangle a 22.5-67.5-90 triangle.
Let FH = 2, as well as FK (and the other six sides of the regular octagon, as well), and GF would then equal 1, since G is the midpoint of FH. Triangle KNF is a 45-45-90 triangle with hypotenuse length 2, giving it a leg length of 2/√2, or simply √2. This makes segment XN (with X the midpoint of EK) have a length of 1 + √2, and the light blue segment, AG, has this same length of 1 + √2, by horizontal translation to the left.
The hypotenuse of the yellow 22.5-67.5-90 triangle can then be found using the Pythagorean theorem, since it is is known that the short leg (GF) has a length of 1, while the long leg (AG) has a length of 1+√2. Let this hypotenuse (AF, shown in red) be x, and then x2 = 12 + (1 + √2)2 = 1 + 1 + 2√2 + 2 = 4 + 2√2, so x, and therefore the hypotenuse, has a length of √(4+2√2).
The 22.5-67.5-90 triangle, therefore, has a short leg:long leg:hypotenuse ratio of 1:1+√2:√(4+2√2).