<s>[INST] How to prove such $|\mu_{1}a_{1}+\mu_{2}a_{2}+\cdots+\mu_{n}a_{n}|\le\frac{1}{a}$ let $a$ is give postive real number,and $a_{1},a_{2},\cdots,a_{n}$ be postive real numbers,and such
$$a^2_{1}+a^2_{2}+\cdots+a^2_{n}=1,a_{1}+a_{2}+\cdots+a_{n}=a$$
show that: there exist $\mu_{i}\in\{-1,1\},i=1,2,\cdots,n$ such
$$|\mu_{1}a_{1}+\mu_{2}a_{2}+\cdots+\mu_{n}a_{n}|\le\dfrac{1}{a}\tag{1}$$
I think use this identity:
$$\sum_{\mu_{i}\in\{-1,1\}}|\mu_{1}a_{1}+\mu_{2}a_{2}+\cdots+\mu_{n}a_{n}|^2=2^n\sum_{k=1}^{n}a^2_{i}=2^n$$
By the Pigeonhole Principle we obatain:
$$|\mu_{1}a_{1}+\mu_{2}a_{2}+\cdots+\mu_{n}a_{n}|^2\le\dfrac{2^n}{2^n}= 1$$
or
$$|\mu_{1}a_{1}+\mu_{2}a_{2}+\cdots+\mu_{n}a_{n}|\le 1$$
or
but I can't prove the stronger inequality $(1)$,thanks 
 [/INST] Let us show the following more general proposition.
Let $a_{1},a_{2},\cdots,a_{n}$ be positive real numbers. Then there exist $\mu_{i}\in\{-1,1\},i=1,2,\cdots,n$ such
$$0\le(\mu_{1}a_{1}+\mu_{2}a_{2}+\cdots+\mu_{n}a_{n})(a_{1}+a_{2}+\cdots+a_{n})\le a_{1}^2+a_{2}^2+\cdots+a_{n}^2\tag{1}$$
Proof by induction on $n$.
The proposition is trivially true for the base case, $n=1$.
Assume it is true for $n$. Consider the case of $n+1$. WLOG, suppose $a_1\ge a_2\ge\cdots\ge a_n\ge a_{n+1}\gt0$. By assumption, there exist $\mu_{i}\in\{-1,1\},i=1,2,\cdots,n$ such that inequality $(1)$ holds.
There are two cases.


*

*$\mu_{1}a_{1}+\mu_{2}a_{2}+\cdots+\mu_{n}a_{n} \ge a_{n+1}$. Let $\mu_{n+1}=-1$. Then,
$$0\le\mu_{1}a_{1}+\mu_{2}a_{2}+\cdots+\mu_{n}a_{n}+\mu_{n+1}a_{n+1}.$$
Moreover, $$\begin{aligned}
&\qquad(\mu_{1}a_{1}+\mu_{2}a_{2}+\cdots+\mu_{n}a_{n}+\mu_{n+1}a_{n+1}) (a_{1}+a_{2}+\cdots+a_{n}+a_{n+1}) \\
&=(\mu_{1}a_{1}+\mu_{2}a_{2}+\cdots+\mu_{n}a_{n}- a_{n+1})(a_{1}+a_{2}+\cdots+a_{n}+a_{n+1}) \\
&=(\mu_{1}a_{1}+\mu_{2}a_{2}+\cdots+\mu_{n}a_{n})(a_{1}+a_{2}+\cdots+a_{n})\\ &\qquad-a_{n+1}(a_{1}(1-\mu_1)+a_{2}(1-\mu_2)+\cdots+a_{n}(1-\mu_{n}))-a_{n+1}^2\\
&\lt (\mu_{1}a_{1}+\mu_{2}a_{2}+\cdots+\mu_{n}a_{n})(a_{1}+a_{2}+\cdots+a_{n})\\
&\le a_{1}^2+a_{2}^2+\cdots+a_{n}^2\\
&\lt a_{1}^2+a_{2}^2+\cdots+a_{n}^2+a_{n+1}^2.\\
\end{aligned}$$

*$\mu_{1}a_{1}+\mu_{2}a_{2}+\cdots+\mu_{n}a_{n} \lt a_{n+1}$. Let $\nu_i=-\mu_i$ for $1\le i\le n$ and $\nu_{n+1}=1$. Then,
$$0\le \nu_{1}a_{1}+\nu_{2}a_{2}+\cdots+\nu_{n}a_{n}+\nu_{n+1}a_{n+1}.$$
Moreover, $$\begin{aligned}
&\qquad(\nu_{1}a_{1}+\nu_{2}a_{2}+\cdots+\nu_{n}a_{n}+\nu_{n+1}a_{n+1}) (a_{1}+a_{2}+\cdots+a_{n}+a_{n+1}) \\
&=(a_{n+1}-(\mu_{1}a_{1}+\mu_{2}a_{2}+\cdots+\mu_{n}a_{n}))(a_{1}+a_{2}+\cdots+a_{n}+a_{n+1}) \\
&\le a_{n+1}(a_{1}+a_{2}+\cdots+a_{n}+a_{n+1}) \\
&\le a_{1}^2+a_{2}^2+\cdots+a_{n}^2+a_{n+1}^2.\\
\end{aligned}$$
</s>