2. Given that for any real number $x$ we have $a \cos x + b \cos 2x \geqslant -1$.
Then the maximum value of $a + b$ is $\qquad$
2. 2 .

Let $x=\frac{2 \pi}{3}$, then $a+b \leqslant 2$.
When $a=\frac{4}{3}, b=\frac{2}{3}$,
$$
\begin{array}{l}
a \cos x+b \cos 2 x=\frac{4}{3} \cos x+\frac{2}{3} \cos 2 x \\
=\frac{4}{3} \cos ^{2} x+\frac{4}{3} \cos x-\frac{2}{3} \\
=\frac{4}{3}\left(\cos x+\frac{1}{2}\right)^{2}-1 \\
\geqslant-1 .
\end{array}
$$