The projection of a point to a ball.

99 Views Asked by At

I woul'd like to solve this. $argmin_{x│||x||≤R} ||x-y||$ This problem is equivalent to $argmin_{x│||x||^2≤R^2} ∑_{(i=1)}^d(x_i-y_i )^2 $. The Lagrangian is $L(w,a)=||w-y||+a(||w||^2-R^2 )=∑_{(i=1)}^d(w_i-y_i )^2 +a∑_{(i=1)}^d(w_i )^2 -aR^2$

It is easy to see that this is a convex problem. So I solved the dual problem:

$∇_{(w_i )} L(w,a)=2(w_i-y_i )+2aw_i$

$2(w_i-y_i )+2aw_i=0$

$w_i-y_i+aw_i=0$

$w_i=y_i/(1+a)$

$g(a)=∑_{i=1}^d(y_i/(1+a)-y_i )^2 +a∑_{i=1}^d(y_i/(1+a))^2 -aR^2=-(Σy_i^2)/(1+a)+Σy_i^2-aR^2$

$g'(a)=(Σy_i^2)/(1+a)^2 -R^2=0$

$(Σy_i^2)/(1+a)^2 =R^2$

$(1+a)^2/(Σy_i^2 )=1/R^2 $

$a=√(Σy_i^2 )/R-1=|(|y|)|/R-1$

$w_i=R*y_i/||y||$

This sultion holds when y is out of the ball ($√(Σy_i^2 )>R$) but when y is in the ball the solution is y itself. What am I doing worng? Thanks.

1

There are 1 best solutions below

4
On BEST ANSWER

The sollution you have is only for the surface of the ball. However, you have to take into account the interour also. You have to find the optimum in the interiour, then in the surface and finally compare both ones and pick the smaller.

You solve it for the interiour this way: You find an optimum in $\Bbb{R}^n$ and then you check if it is inside the ball. If it is inside the ball, it is your candidate. Otherwise, you have no optimum in the interiour and therefore no candidate.

You can see easily that the optimum for $\Bbb{R^n}$ is at $x=y$ because the norm can't be smaller than 0. And if $y$ is inside the ball, it is the minimum. You can proove that the other candidate is bigger. Otherwise, you have only one candidate which is the one you calculated.