Connecting smooth functions in a smooth way Let $a<b<c<d$ be real values, and let $f \in C^{\infty}([a,b])$ and $g \in C^{\infty}([c,d])$. Is there a way to "connect" these functions in a smooth way? That is, is there a function $h \in C^{\infty}([a,d])$ such that $h=f$ on $[a,b]$ and $h=g$ on $[c,d]$?
If this is true, how is the proven? Is the proof non-constructive, or is there an explicit way to do it?
 A: There is a well known result of Borel that will be useful here.
Borel's theorem on power series: Let $x_0\in \mathbb R.$ Given $a_0,a_1, \dots \in \mathbb R,$ there exists $f\in C^\infty(\mathbb R)$ such that
$$\tag 1 D^nf(x_0) = a_n, n=0,1,\dots.$$
This is stated here, with a sketch of the proof, at the very end: http://math.caltech.edu/~nets/lecture12.pdf. The statement there is not exactly $(1),$ but the two are clearly equivalent. (I'd refer you to the wikipedia page on this, but the author there gets all caught up in stating a very general version, which we don't need.)
Corollary: If $f\in C^\infty[a,b],$ then there exists $F\in C^\infty(\mathbb R)$ such that $F= f$ on $[a,b].$
Proof: By Borel, there exists $f_1 \in C^\infty(\mathbb R)$ such that
$$D^nf_1(a) = D^nf(a), n=0,1,\dots.$$
There also exists $f_2 \in C^\infty(\mathbb R)$ such that
$$D^nf_2(b) = D^nf(b), n=0,1,\dots.$$
Now define
$$F(x) = \begin{cases} f_1(x) ,\qquad x \le a \\  f(x) , \qquad x\in [a,b] \\ f_2(x) ,\qquad x \ge b \\
 \end{cases}$$
This $F$ does the job: It equals $f$ on $[a,b],$ it's clearly in $C^\infty(\mathbb R\setminus \{a,b\}),$ and Borel gives us exactly the match-up at $a,b$ we need to see $F\in C^\infty(\mathbb R).$
So now to your set up with $f\in C^\infty([a,b]),g\in C^\infty([c,d]): $ We choose $F$ relative to $f,$ and  $G$ relative to $g,$ as in the corollary. We also choose "blending" functions $\alpha, \beta \in C^\infty(\mathbb R)$ that do the following:
$$\alpha (x) = \begin{cases} 1, \qquad x\in (-\infty,b] \\ 0, \qquad x\in [c,\infty)\\
 \end{cases}$$
$$\beta (x) = \begin{cases} 1, \qquad x\in [c,\infty) \\ 0, \qquad x\in (-\infty,b]\\
 \end{cases}$$
Then $h=\alpha F + \beta G$ solves your problem with room to spare: It belongs to $C^\infty(\mathbb R),$ it equals $f$ on $[a,b],$ and equals $g$ on $[c,d].$
A: If you extent $f(x)$ $\forall \epsilon>0$ from $[a,b]$ to $[a,b+\epsilon]$ (which I guess can be done in the sense of the series-expression as all derivatives are defined), so that you are free to do whatever you want on $(b,b+\epsilon]$ and likewise $g(x)$ from $[c,d]$ to $[c-\epsilon,d]$, then you can blend it by
$$
h(x) = \left\{\Theta\left[ a \leq x \leq b \right] + \varphi_\epsilon\left(x-b\right)\right\} f(x) + \left\{\Theta\left[ c \leq x \leq d \right] + \varphi_\epsilon\left(c-x\right)\right\} g(x)
$$
where
$$
\Theta\left[ a \leq x \leq b \right] = \begin{cases} 1 \qquad a \leq x \leq b \\ 0 \qquad {\rm else} \end{cases}
$$
and
$$
\varphi_\epsilon\left(x\right) = \begin{cases} 0 \qquad x \leq 0 \\ \tanh^2\left(\frac{1}{x\cosh\left(\frac{1}{x-\epsilon}\right)}\right) \qquad 0 < x < \epsilon \\ 0 \qquad \epsilon \leq x\end{cases} \, .
$$
