2. Given the sets $A=\{(x, y) \mid | x|+| y | = a, a>0\}, B=\{(x, y) \mid | x y |+1 = |x|+|y|\}$. If $A \cap B$ is the set of vertices of a regular octagon on the plane, then the value of $a$ is
Solve As shown in the figure, the coordinates of the two vertices of the regular octagon in the first quadrant should satisfy
$$
\left\{\begin{array}{l}
x+y=a, \\
x y=a-1 .
\end{array}\right.
$$

Solving, we get $\left\{\begin{array}{l}x_{1}=1, \\ y_{1}=a-1\end{array}\right.$ or $\left\{\begin{array}{l}x_{2}=a-1, \\ y_{2}=1 .\end{array}\right.$.
According to the problem, $k_{O P}=\operatorname{tg} \frac{\pi}{8}=\sqrt{2}-1$, so $a_{1}$
$$
\begin{array}{l}
-1=\sqrt{2}-1, a_{1}=\sqrt{2} \text { or } a_{2}-1=\frac{1}{\sqrt{2}-1} \\
=\sqrt{2}+1, a_{2}=2+\sqrt{2} .
\end{array}
$$