Example 3. Solve the equation $\sin x + \cos x + \sin x \cos x = 1$
Let $\sin x + \cos x = y$.
From formula (4), we have
$$
\sin x \cos x = \frac{1}{2}(y^2 - 1)
$$

Thus, the original equation becomes $y + \frac{1}{2}(y^2 - 1) = 1$,
(2) $y^2 + 2y - 3 = 0$.

Solving this, we get: $y = 1, y = -3$ (discard).
Therefore, $\sin x + \cos x = 1$,
which means $\sqrt{2 \sin}(45^\circ + x) = 1$.
Solving this, we get $\left\{x \left\lvert\, x = n\pi - \frac{\pi}{4} + (-1)^n \frac{\pi}{4}\right.\right.$
$$
n \in \mathbb{Z}\} \text{. }
$$