Example 10 When $a, b$ take what real numbers, the equation
$$
x^{2}+2(1+a) x+\left(3 a^{2}+4 a b+4 b^{2}+2\right)=0
$$

has real roots?
(1987, National Junior High School Mathematics League)
Solution: When $\Delta \geqslant 0$, the equation has real roots
$$
\begin{array}{l}
\Leftrightarrow[2(1+a)]^{2}-4\left(3 a^{2}+4 a b+4 b^{2}+2\right) \geqslant 0 \\
\Leftrightarrow 2 a^{2}+4 a b+4 b^{2}-2 a+1 \leqslant 0 \\
\Leftrightarrow(a+2 b)^{2}+(a-1)^{2} \leqslant 0 . \\
\text { Also, }(a+2 b)^{2}+(a-1)^{2} \geqslant 0, \text { therefore, only }
\end{array}
$$

Also, $(a+2 b)^{2}+(a-1)^{2} \geqslant 0$, therefore, only $(a+2 b)^{2}=0$ and $(a-1)^{2}=0$, that is
$$
a=1, b=-\frac{1}{2} \text {. }
$$

Thus, when $a=1, b=-\frac{1}{2}$, the given equation has real roots.