3. The numbers $x_{1}, \ldots, x_{n}, y_{1}, \ldots, y_{n}$ satisfy the condition $x_{1}^{2}+\ldots+x_{n}^{2}+y_{1}^{2}+\ldots+y_{n}^{2} \leqslant 2$. Find the maximum value of the expression

$$
A=\left(2\left(x_{1}+\ldots+x_{n}\right)-y_{1}-\ldots-y_{n}\right) \cdot\left(x_{1}+\ldots+x_{n}+2\left(y_{1}+\ldots+y_{n}\right)\right)
$$
Answer: $5 n$.

Solution 1. For $k=1, \ldots, n$ let $t_{k}=3 x_{k}+y_{k}, s_{k}=x_{k}-3 y_{k}$. Then

$$
\begin{aligned}
\left.4 A=\left(4 x_{1}+\ldots+4 x_{n}-2 y_{1}-\ldots-2 y_{n}\right) \cdot\left(2 x_{1}+\ldots+2 x_{n}+4 y_{1}+\ldots+4 y_{n}\right)\right) & = \\
=\left(\sum_{k=1}^{n}\left(3 x_{k}+y_{k}\right)+\sum_{k=1}^{n}\left(x_{k}-3 y_{k}\right)\right) \cdot\left(\sum_{k=1}^{n}\left(3 x_{k}+y_{k}\right)-\sum_{k=1}^{n}\left(x_{k}-3 y_{k}\right)\right) & =\left(\sum_{k=1}^{n} t_{k}\right)^{2}-\left(\sum_{k=1}^{n} s_{k}\right)^{2}
\end{aligned}
$$

Notice that

$$
\sum_{k=1}^{n} t_{k}^{2} \leqslant \sum_{k=1}^{n}\left(t_{k}^{2}+s_{k}^{2}\right)=10 \cdot \sum_{k=1}^{n}\left(x_{k}^{2}+y_{k}^{2}\right) \leqslant 20
$$

from which

$$
4 A \leqslant\left(\sum_{k=1}^{n} t_{k}\right)^{2} \leqslant n \sum_{k=1}^{n} t_{k}^{2} \leqslant 20 n
$$

Thus, $A \leqslant 5 n$. Equality is achieved when $x_{1}=\ldots=x_{n}=\frac{3}{\sqrt{5 n}}$ and $y_{1}=\ldots=y_{n}=\frac{1}{\sqrt{5 n}}$.

Solution 2. Consider in $\mathbb{R}^{2 n}$ the vectors

$$
\bar{a}=(2, \ldots, 2,-1, \ldots,-1), \quad \bar{b}=(1, \ldots, 1,2, \ldots, 2), \quad \bar{c}=\left(x_{1}, \ldots, x_{n}, y_{1}, \ldots, y_{n}\right)
$$

Notice that $|\bar{a}|=|\bar{b}|=\sqrt{5 n}$, and the length of $\bar{c}$ can be considered as $\sqrt{2}$. Let $\alpha, \beta$ be the angles between $\bar{c}$ and the vectors $\bar{a}, \bar{b}$ respectively. Then

$$
A=2 \cdot|\bar{a}| \cdot|\bar{b}| \cdot \cos \alpha \cos \beta=10 n \cdot \cos \alpha \cos \beta
$$

The angles between $\bar{a}, \bar{b}$ and the projection of $\bar{c}$ onto the plane generated by these vectors do not exceed $\alpha, \beta$ respectively. Therefore, we can assume that the vectors $\bar{a}, \bar{b}, \bar{c}$ are coplanar. Since $\bar{a} \perp \bar{b}$, we get $A=10 n \cdot \cos \alpha \sin \alpha$. The maximum of this expression is $5 n$.