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 
 A: 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}$$
A: There are two general ways one might try to tackle something like this. One is the probabilistic method which you noted does not work. Another is an extremal approach as follows.
Consider the choice of signs that minimize $ |\sum \mu_i a_i|^2$ and denote $y = \sum \mu_i a_i$ for this choice. By flipping the signs of $a_i$ if necessary, we can assume that $y = \sum a_i$. Then by flipping the sign of $a_1$, we get a strictly larger square so we have $y^2 \le (y-2a_1)^2$ which implies that $a_1y \le a_1^2$. Of course we can replace $a_1$ with any other $a_j$'s and summing the resulting inequalities give us $a y \le 1$ as desired. 
This was inspired by the answer to this problem: https://mathoverflow.net/questions/352720/reference-to-a-conjecture-on-unit-vectors-in-euclidean-space/352817#352817
