Union of convex sets
I have the following problem:
Let $K$ and $K'$ be two convex compact sets in $\mathbb{R}^n$, with $n \geq 2$. Assume that $K$ and $K'$ both have a smooth ($\mathcal{C}^2$) boundary. Assume moreover that $K \cup K'$ is convex. Then is the boundary of $K \cup K'$ also $\mathcal{C}^2$?
~~~~~
Edit : I'll add some context.
The motivation of the question is that I would like to prove that curvature integrals are additive over the space of $\mathcal{C}^2$ convex compact sets, which basically boils down to this problem.
My guess is that the answer is positive. Here are some elements in two dimensions. Let $K$ and $K'$ be two convex compact sets in $\mathbb{R}^2$ with smooth boundary, and assume that $K \cup K'$ is also convex. Let $x \in \partial K \cap \partial K'$. Then $\partial K$ and $\partial K'$ have the same tangent space in $x$; otherwise, $K \cup K'$ would not be convex. Now, let us look at the curvature at $x$. If the curvature of $\partial K$ is strictly smaller than the curvature of $\partial K'$, then $K'$ is locally included into $K$, so $\partial K \cup K'$ is locally $\partial K$, which is $\mathcal{C}^2$. The same holds if we exchange $K$ and $K'$. The last possibility is that both curvatures are equal, which "trivially"* imply that the second derivative of any reasonable parametrization of $\partial K \cup K'$ in a neighborhood of $x$ is $\mathcal{C}^2$. In all cases, $\partial K \cup K'$ is a $\mathcal{C}^2$ curve.
This is sketchy, I am not really sure I can write it down neatly, let alone tackle higher dimensions...
$*$ this may be Jordan-theorem-like trivial: getting a rigorous proof does not look that easy...
Solution 1:
The problem is the following: if two $\mathcal{C}^2$ functions $f$ and $g$ from $]-\epsilon, \epsilon[$ to $\mathbb{R}$ are convex with $f(0)=g(0)=0$ and if $h=\min(f,g)$ is convex, is $h$ a $\mathcal{C}^2$ function too?
If $f'(0)\neq g'(0)$, $h$ is not convex. So $f'(0)=g'(0)$.
If $f''(0)> g''(0)$, $f(x)\geq g(x)$ in a neighborhood of $0$. So $h=g$ in this neighborhood and $h$ is $\mathcal{C}^2$ in this neighborhood.
So we may suppose $f''(0)=g''(0)$.
Let $I= \{x \in ]-\epsilon, \epsilon[ | f(x)=g(x)\}$,
$I^+= \{x \in ]-\epsilon, \epsilon[| f(x)>g(x)\}$,
$I^-= \{x \in ]-\epsilon, \epsilon[| f(x)<g(x)\}$
(1) If $x \in I^-$: $I^-$ is open so $h=f$ in a neighborhood of $x$, so $h''(x)=f''(x)$ and $h'(x)=f'(x)$.
(2) If $x \in I^+$: $I^+$ is open so $h=g$ in a neighborhood of $x$, so $h''(x)=g''(x)$ and $h'(x)=g'(x)$.
(3) If $x \in I$: $f(x)=g(x):=a$. $h$ is convex, so $f'(x)=g'(x):=b$.
(3.i) if $f''(x)> g''(x)$, as $f'(x)=g'(x)$ ,$f\geq g$ in a neighborhood of $x$, so $h''(x)=g''(x)$ and $h'(x)=g'(x)$.
(3.ii) if $f''(x)<g''(x)$, as $f'(x)=g'(x)$, $f \leq g$ in a neighborhood of $x$, so $h''(x)=f''(x)$and $h'(x)=f'(x)$.
(3.iii) if $f''(x)=g''(x):=c$, for all $u$ in a neighborhood of $0$, $h(x+u)=\min(f(x+u),g(x+u))$ $=\min(f(x)+f'(x)u+(c/2)u^2+ o_1(u^2), g(x)+g'(x)u+ (c/2)u^2+o_2(u^2))=a+bu+(c/2)u^2+o_3(u^2)$. where $\lim_{u \mapsto 0} o_i(u^2)/u^2=0.$ So $h'(x)=b=f'(x)=g'(x)$.
So $\forall x \in ]-\epsilon, \epsilon[, h'(x)=f'(x)$ or $h'(x)=g'(x)$. And $h'(0)=f'(0)=g'(0)$.
So $\forall x \in ]-\epsilon,\epsilon[, \frac{h'(x)-h'(0)}{x} = \frac{f'(x)-f'(0)}{x}$ or $\frac{h'(x)-h'(0)}{x} =\frac{g'(x)-g'(0)}{x}$.
So the limit of $\frac{h'(x)-h'(0)}{x}$ when $x \mapsto 0$ is $f''(0)=g''(0)$.
So $h''(0)=f''(0)=g''(0)$.
By the same way, we show that if $f(z)= g(z)$, then $h''(z)=f''(z)=g''(z)$.
If $f(z) \neq g(z)$, then $h''(z)=f''(z)$ or $h''(z)=g''(z)$.
(1) if $f(z) < g(z)$, it's easy to see that $h(z)=f(z)$ so $h$is $\mathcal{C}^2$ in the neighborhood of $z$.
(2) idem if $f(z)>g(z)$.
(3) if $f(z)=g(z)$, then $f'(z)=g'(z)$.
(3.i) if $f''(z) < g''(z)$, $f \leq g$ in a neighborhood of $z$, so $h=f$ in this neighborhood an is $\mathcal{C}^2$ in this neighborhood.
(3.ii) idem if $f''(z)> g''(z)$.
(3.iii) if $f''(z)=g''(z)$, $h''(z)=f''(z)=g''(z)$.And $\forall y$, $h''(y)=f''(y)$ or $h''(y)=g''(y)$. So $\lim_{y \mapsto z} h''(y)=h''(z)$. So $h''$ is continuous at $z$.
So $h$ is a $\mathcal{C}^2$ function.
[Edit: I believed the problem was in $\mathbb{R}^2$] ]