For $K \subset \mathbb{R}^n$ closed, show that $\frac{d(x, K)}{1 + d(x,K)} \in C^1(\mathbb{R}^n)$. Let $K \subseteq \mathbb{R}^n$ be closed. Let 
$$d(x,K) := \text{dist}(x,K) = \inf_{k \in K}\|x - k\|$$
be the distance function from a point $x \in \mathbb{R}^n$ to the set $K$. 

Show that the function $G(x) = \frac{d(x, K)}{1 + d(x,K)} \in C^1(\mathbb{R}^n).$

This claim is part of the proof of Theorem 2 from section 3.1 in Perko's Differential Equations and Dynamical Systems. This claim is plausible to me, but I'm not exactly sure how to prove it. Of course, we can try to prove the claim by finding an explicit formula for the partial derivatives
$$\lim_{h \to 0} \frac{G(x + he_j) - G(x)}{h} = \cdots .$$
But it seems like this calculation could get messy very quickly. I am also worried that this claim may not be true in general. For instance, what if the boundary of $K$ is very rough. Is $G(x)$ still $C^1$ in that case?
Hints or solutions are greatly appreciated!
 A: This is clearly false. Take $n=1$ and $K=\{0\}$. You get $$G=\frac{|x|}{1+|x|},$$which is not differentiable at the origin.
Edit: No, $G$ need not be smooth in the complement of $K$ either. Take $n=1$ and $K=\{-1,1\}$; then $G$ is not differentiable at $0$.
Edit: Otoh $G$ is $C^1$ in the complement of $K$ if $K$ is convex. In fact $d(x,K)$ is. 
Write $x=(t,y)$ with $t\in\Bbb R$ and $y\in \Bbb R^{n-1}$. Choose coordinates so $p=(1,0)$ and $(0,0)$ is the point of $K$ closest to $p$.
Convexity shows that $\{(0,0)\}\subset K\subset\{t\le 0\}$, hence near $p$ we have $$t^2\le d((t,y),K)^2\le t^2+|y|^2.$$ So $d^2$ is differentiable at $p$, with gradient $(1,0)$.
Edit: I was taking the continuity of the derivative as clear; maybe it's not. A cheap way to show it's continuous:
Say $k(p)$ is the point of $K$ closest to $p$ (note that $K$ convex implies that $p(k)$ is unique). If you undo the "choose coordinates such that..." you see that the gradient of $d^2$ at $p$ is $$\frac{p-k(p)}{||p-k(p)||}.$$(Or if you don't see that it doesn't really matter, it's clear that the argument above shows that the gradient is given by some gizmo in terms of $p$ and $k(p)$.) So it's enough to show that $k(p)$ depends continuously on $p$.
Say $p_n\to p$. Now $k(p_n)$ is certainly bounded, so if $k(p_n)$ does not converge to $k(p)$ there is a subsequence converging to something else; relabelling, we have $k(p_n)\to k_0\ne k(p)$. Now $d(x)=d(x,K)$ is certainly continuous, so $$||p-k_0||=\lim||p_n-k(p_n)||=\lim d(p_n)=d(p)=||p-k(p)||,$$contradicting the uniqueness of $k(p)$.
A: Are there any additional assumptions on $K$? Otherwise I doubt this is true. Look for example at $n=2$ and $K:=\{x=(x_1,x_2): -1\le x_i \le 1\}$, a square. Along the upper boundary the gradient of $d(x, K)$ is just the vector $(0,1)$, along the right hand side boundary its $(1,0)$. This won't be continous at the upper right corner of $K$. The denominator won't help much here. (Am I missing anything here?)
