Let $A$ and $B$ denote open convex subsets of $\mathbb{R}^n$. Suppose $f$ and $g$ are convex functions on $A$ and $B$ respectively, mapping into the real line. It seems likely that if $f$ and $g$ agree on $A \cap B$, and if $A \cup B$ is convex, then $f \cup g : A \cup B \rightarrow \mathbb{R}$ is a convex function.
Question. Is this true?
The assumption that $A$ and $B$ are open is necessary to prevent the following counterexample: $n=1$, $A = [0,1)$, $B=[1,2]$, and $f$ and $g$ are constant functions of different heights.
I will follow gerw's comment :
If $f :(a,c)\rightarrow \mathbb{R},\ g:(b,d)\rightarrow \mathbb{R}$ are convex and $f=g$ on $(b,c)$, then consider $x<b,\ y>c$ Then consider convex hull of $$(x,f(x)),\ (b,f(b)),\ (c,g(c)),\ (y,g(y))$$