I have the following problem
Consider the problem to find the minimizer of $f(x)=\displaystyle \sum_{j=1}^{n}(x_{j}-a_{j})^{2}$, $a_{j}\in \mathbb{R}$, $j=1,2,\dots, n$, $\hspace{2mm}$ restricted to $\displaystyle\sum_{j=1}^{n}x_{j}^{2}\leq 1,\hspace{3mm}\displaystyle\sum_{j=1}^{n}x_{j}= 0 $.
The KKT system is
- $L_{x_{j}}(x,\mu_{1},\mu_{2})=2(x_{j}-a_{j})+\lambda +2\mu x_{j}=0\hspace{4mm}\text{para}\hspace{2mm}j=1,2,\cdots, n$;
2.$\mu\geq 0$;
3.$\mu\left[\displaystyle \sum_{j=1}^{n}x_{j}^{2}-1\right]=0$;
4.$\sum_{j=1}^{n}x_{j}= 0$;
- $\displaystyle \sum_{j=1}^{n}x_{j}^{2}-1\leq 0$;
We will consider cases
a. If $\mu=0$, then in 1. we have $x_{j}=\frac{2a_{j}-\lambda}{2}$, put this value in 4. We have $\lambda= \frac{2}{n}\displaystyle \sum_{j=1}^{n}a_{j}$, Thus $x_{j}= a_{j}-\frac{1}{n}\displaystyle \sum_{j=1}^{n}a_{j}$. But in this point I'm stuck, since I don't know how to verify that the 5. is true or false.
b. If $\mu \neq 0$, the only that I have is that $\displaystyle \sum_{j=1}^{n}x_{j}^{2}-1=0$ but I'm not to sure how use this fact.
Thanks in advance!
Assume that $\mu\ne0$, and summing 1. over $i=1,\ldots,n$ yields
$$\lambda=\dfrac{2}{n}\sum_{i=1}^na_i=2\bar{a},$$
where $\bar a:=\dfrac{1}{n}\sum_{i=1}^na_i$ is the mean value of the sequence $\{a_1,\ldots,a_n\}$ and where we have used 4.
Now, from 1., again, we have that
$$(1+\mu)x_j=a_j-\bar{a}.$$
Squaring and summing yields
$$(1+\mu)^2=\sum_{i=1}^n(a_j-\bar{a})^2,$$
where we have used 5., which is an equality here. Let $V(a)=\sum_{i=1}^n(a_j-\bar{a})^2/n$ which is the variance of the sequence $\{a_1,\ldots,a_n\}$. Then, we have that
$$(1+\mu)^2=nV(a)$$
and
$$\mu=(nV(a))^{1/2}-1.$$
This finally yields
$$x_j=\dfrac{a_j-\bar{a}}{(nV(a))^{1/2}}.$$