Hadamard's lemma for arbitrary open subsets I am struggling with the following. It regards the variants of Hadamard's lemma for smooth functions. I have found basically two statements. The usual one, which can be found e.g. on Wikipedia (https://en.wikipedia.org/wiki/Hadamard%27s_lemma) is the following:
Hadamard's Lemma I: Let $U \subseteq \mathbb{R}^{n}$ be a star-convex neighborhood of a point $a$. Let $f: U \rightarrow \mathbb{R}^{p}$ be a smooth map. Then for any $x \in U$, one has
$f(x) = f(a) + (h^{(a)}(x))(x-a)$,
for some smooth map $h^{(a)}: U \rightarrow Lin(\mathbb{R}^{n},\mathbb{R}^{p})$.
Next, I have found a version for arbitrary open set $U$, but with a weaker statement (see Lemma 2.2.7 in Duistermaat - Kolk https://books.google.cz/books?id=5KXkkGTnaYIC) which says the following:
Hadamard's Lemma II: Let $U \subseteq \mathbb{R}^{n}$ be any neighborhood of point $a$. Let $f: U \rightarrow \mathbb{R}^{p}$ be differentiable at $a$. Then for any $x \in U$, one has
$f(x) = f(a) + (h^{(a)}(x))(x-a)$,
for some map $h^{(a)}: U \rightarrow Lin(\mathbb{R}^{n},\mathbb{R}^{p})$ continuous at $a$.
The actual question: Can the star-convexity of $U$ in assumptions of Lemma I be dropped? I understand how it is used in the proof (integration along line segments connecting $a$ to $x$). Are there some counter-examples? It follows from the proof of Lemma II that $h^{(a)}$ is continous on entire $U$, but I am unable to prove that it is smooth.
Thank you, Jan
 A: Let $U\subset\mathbb{R}^n$ be an arbitrary open subset and $a\in U$.
For some $\varepsilon>0$, let $B_\varepsilon$ be an open $\varepsilon$-ball centered at $a$ which is contained in $U$ (a star shaped set).
We denote 
$$ U_1:= B_\varepsilon. $$
Suppose that $f: U \rightarrow \mathbb{R}^p$ is a smooth function.
Given $x\in U_1$, the line $t\in[0,1]\mapsto a+t(x-a)$ lies in the ball $U_1$.
Therefore, we can define the linear map
$$ h_1(x) := \int_0^1 Df(a+t(x-a)) dt:\quad\mathbb{R}^n \longrightarrow \mathbb{R}^p. $$
This prescription gives a smooth map $h_1 : U_1\rightarrow Lin(\mathbb{R}^n,\mathbb{R}^p)$.
The Fundamental theorem of calculus implies that for all $x\in U_1$, the following holds:
$$ h_1(x)(x-a) = f(x) - f(a). $$
Consider the open subset
$$ U_2:= U\backslash \overline{B}_{\varepsilon/2}. $$
For an $x\in U_2$, define the linear map
$$ h_2(x) = (f(x)-f(a))\otimes L_a(x):\quad \mathbb{R}^n\longrightarrow\mathbb{R}^p, $$
where $L_a(x): \mathbb{R}^n \rightarrow \mathbb{R}$ is any linear functional such that 
$$ L_a(x) (x-a) = 1. $$
Note that any family $L_a(x), x\in U$ must necessarily blow-up at $x=a$.
We take
$$ L_a(x) = \frac{(x-a)\cdot}{||x-a||^2}, $$
where $\cdot$ denotes the dot product.
Because $a\not\in U_2$, the function $h_2: U_2 \rightarrow Lin(\mathbb{R}^n,\mathbb{R}^p)$ is smooth.
By construction, for every $x\in U_2$, it holds
$$ h_2(x)(x-a) = f(x) - f(a). $$
Let $\lambda_1$, $\lambda_2$ be a partition of unity on $\mathbb{R}^n$ subordinate to $U_1$, $U_2\cup \mathbb{R}^n\backslash U$.
For all $x\in U$, set
$$ h(x) := \lambda_1(x) h_1(x) + \lambda_2(x) h_2(x):\quad\mathbb{R}^n\rightarrow\mathbb{R}^p. $$
This defines a smooth function $h: U \rightarrow Lin(\mathbb{R}^n,\mathbb{R}^p)$.
For all $x\in U$, it holds
\begin{align*}
h(x)(x-a) &= \lambda_1(x) h_1(x)(x-a) + \lambda_2(x) h_2(x) (x - a)\\
& = \lambda_1(x) (f(x) - f(a)) + \lambda_2(x) (f(x)-f(a)) \\
& = (\lambda_1(x) + \lambda_2(x))(f(x)-f(a)) \\
& = f(x) - f(a).
\end{align*}
Therefore, for all $x\in U$, we have 
$$ f(x) = f(a) + h(x) (x-a), $$
where $h: U\rightarrow Lin(\mathbb{R}^n,\mathbb{R}^p)$ is a smooth function.
This should be what you asked for.
