3. Given real numbers $x_{1}, \ldots, x_{n}$. Find the maximum value of the expression

$$
A=\left(\sin x_{1}+\ldots+\sin x_{n}\right) \cdot\left(\cos x_{1}+\ldots+\cos x_{n}\right)
$$
Answer: $\frac{n^{2}}{2}$.

Solution. Note that for any $a_{1}, \ldots, a_{n}$

$$
\left(\sum_{k=1}^{n} a_{k}\right)^{2} \leqslant n \sum_{k=1}^{n} a_{k}^{2}
$$

From this, by the Cauchy inequality,

$$
A \leqslant \frac{1}{2}\left(\left(\sum_{k=1}^{n} \sin x_{k}\right)^{2}+\left(\sum_{k=1}^{n} \cos x_{k}\right)^{2}\right) \leqslant \frac{n}{2}\left(\sum_{k=1}^{n} \sin ^{2} x_{k}+\sum_{k=1}^{n} \cos ^{2} x_{k}\right)=\frac{n^{2}}{2}
$$

Equality is achieved when $x_{1}=\ldots=x_{n}=\frac{\pi}{4}$.