2. Solve the system of equations

$$
\left\{\begin{array}{l}
x y=1 \\
x+y+\cos ^{2} z=2
\end{array}\right.
$$
Solution. From the first equation, we obtain that the real numbers $x$ and $y$ have the same sign. Since $0 \leq \cos ^{2} z \leq 1$ for any real number $z$, we get that

$$
x+y=2-\cos ^{2} z \geq 1
$$

Since $x$ and $y$ have the same sign, we conclude that they are positive.

From the inequality between the arithmetic and geometric means for positive real numbers $x$ and $y$ such that $x y=1$, we have

$$
x+y \geq 2 \sqrt{x y}=2
$$

On the other hand, $x+y=2-\cos ^{2} z \leq 2$, so according to this, $x+y=2$. Now we obtain the system

$$
\left\{\begin{array}{l}
x y=1 \\
x+y=2
\end{array}\right.
$$

It is not difficult to verify that the only positive solution to the system is $x=y=1$.

Then from the second equation of the original system, we get $\cos ^{2} z=0$, whose solutions are $z=\frac{\pi}{2}+k \pi$. Finally, the solutions to the system are $\left\{\left.\left(1, \frac{\pi}{2}+k \pi\right) \right\rvert\, k \in \mathbb{Z}\right\}$.