0

I am looking for a proof of the gradient of a squared distance function to a set $\mathcal{C}$, where the function can be shown as $$f(z) := \operatorname{dist}^2\left(z\right) = \frac{1}{2}\|z - \operatorname{proj}_{\mathcal{C}}\left( z \right) \|_2^2 .$$

What will be the gradient of $\operatorname{proj}_{\mathcal{C}}\left( z \right)$ with respect to $z$ in general?


Background: I am trying to prove the proximal operator of a squared distance function as attempted herein Proximal operator of squared Euclidean distance to a set, i.e., $\operatorname{dist}\left(\right)$, where I am unsure about the gradient of such a squared distance function.


ADD: I found same question Gradient of $\mbox{dist}\left(x, D \right)^2:= \left\| x - P_{D}(x)\right\|_2^2$, where $P_{D}(x)$ is a projection operator, but the proofs are bit too heavy (at least) for me.

user550103
  • 2,773

1 Answers1

1

Let $\,p=\operatorname{proj_{\cal C}}(z).\;$ Then what the linked answer (and especially the comments) are saying is that $p$ is not differentiable, which leaves a simple quadratic problem, i.e. $$\eqalign{ f &= \frac 12(z-p):(z-p) \\ df &= (z-p):dz \\ \frac{\partial f}{\partial z} &= (z-p) \\ }$$ As a concrete example, suppose you are projecting into the positive orthant of ${\mathbb R}^{2}$, then every $z$ in the negative orthant is projected to $\,p=(0\;\;0)^T,\,$ i.e. the origin.

greg
  • 40,033