2. Let $a_{1}, a_{2}, \ldots, a_{2008}$ be real numbers such that

$$
\left\{\begin{array}{l}
a_{1}+a_{2}+a_{3}+\ldots+a_{2008}=0 \\
a_{1}^{2}+a_{2}^{2}+a_{3}^{2}+\ldots+a_{2008}^{2}=502
\end{array}\right.
$$

Determine the maximum value of $a_{2008}$. Find at least one sequence of values $a_{1}, a_{2}, \ldots, a_{2007}$ in which it is achieved.
Solution. According to the Cauchy-Bunyakovsky-Schwarz inequality, for real numbers $a_{1}, a_{2}, \ldots, a_{2007}$ we have

$$
\begin{aligned}
\left(a_{1}+a_{2}+\ldots+a_{2007}\right)^{2} & =\left(1 \cdot a_{1}+1 \cdot a_{2}+\ldots+1 \cdot a_{2007}\right)^{2} \\
& \leq(\underbrace{1^{2}+1^{2}+\ldots .1^{2}}_{2007-\text { times }})\left(a_{1}^{2}+a_{2}^{2}+\ldots+a_{2007}^{2}\right) \\
& =2007\left(a_{1}^{2}+a_{2}^{2}+\ldots+a_{2007}^{2}\right)
\end{aligned}
$$

Equality is achieved if and only if $\frac{a_{1}}{1}=\frac{a_{2}}{1}=\frac{a_{3}}{1}=\ldots=\frac{a_{2007}}{1}$, that is,

$$
a_{1}=a_{2}=\ldots=a_{2007}
$$

We will write the equalities (1) as

$$
\left\{\begin{array}{l}
a_{1}+a_{2}+a_{3}+\ldots+a_{2007}=-a_{2008} \\
a_{1}^{2}+a_{2}^{2}+a_{3}^{2}+\ldots+a_{2007}^{2}=502-a_{2008}^{2}
\end{array}\right.
$$

and if we substitute in (2) we get

$$
\left(-a_{2008}\right)^{2} \leq 2007\left(502-a_{2008}^{2}\right)
$$

Thus, $a_{2008}^{2} \leq \frac{2007 \cdot 502}{2008}=\frac{2007}{4}$, from which we get $\left|a_{2008}\right| \leq \frac{\sqrt{2007}}{2}$.

For any sequence of real numbers $a_{1}, a_{2}, \ldots, a_{2007}$, for which $a_{1}=a_{2}=\ldots=a_{2007}$ is satisfied, $\left|a_{2008}\right| \leq \frac{\sqrt{2007}}{2}$. Therefore, $\left(a_{2008}\right)_{\max }=\frac{\sqrt{2007}}{2}$.