## Return to Answer

2 added constructionof function

From a more pedestrian point of view: If what you want is possible at all (and it is) then in particular there is some non-decresing $f_3 \in {\cal C}^{\infty}([x_1,x_n],{\mathbb R})$ with $f_3(x_1)=f_3(x_2)=0$ and$f_3(x_3)=f_3(x_4)=\cdots=f_3(x_n)=1$. i.e. a ${\cal C}^{\infty}$ function on $\mathbb R$ which is $0$ up to $x_2$ then increases to $1$ and then is $1$ from $x_3$ on. Then If so, then one can have $n$ similar functions $f_k$ with $f_k(x_j)=$ $0$ or $1$ according as $j < k$ or $k \le j$. They span a degree $n$ space $V$ and the non-negative linear combinations of the $f_k$ do what you want.

It remains only to show how to build the $f_k$. That must be a standard construction. I recall doing this once using as an ingredient Here's one way, maybe not the most elegant: First consider ${\cal C}^{\infty}$ function $f$ g_3$which is$0$for except on the open interval$x \le 0$and (x_2,x_3)$ where it is $e^{-1/x^2}$ for $e^{-1/(x-x_2)^2}e^{-1/(x-x_3)^2}$$Then let $0<x$. One needs a way to put in an inflection point at f_3(x)=c\int_{-\infty}^{x}g_3(t)\ dt$ where the constant $1/2$ and have it be c>0$is chosen to make$1$f_3(x)=1$ for $x\ge 1$. Perhaps Pietro's answer does this more elegantlyx \ge x_3$. 1 From a more pedestrian point of view: If what you want is possible at all (and it is) then in particular there is some non-decresing$f_3 \in {\cal C}^{\infty}([x_1,x_n],{\mathbb R})$with$f_3(x_1)=f_3(x_2)=0$and$f_3(x_3)=f_3(x_4)=\cdots=f_3(x_n)=1$. i.e. a${\cal C}^{\infty}$function on$\mathbb R$which is$0$up to$x_2$then increases to$1$and then is$1$from$x_3$on. Then one can have$n$similar functions$f_k$with$f_k(x_j)=0$or$1$according as$j < k$or $k \le j$. They span a degree$n$space$V$and the non-negative linear combinations of the$f_k$do what you want. It remains only to show how to build the$f_k$. That must be a standard construction. I recall doing this once using as an ingredient the${\cal C}^{\infty}$function$f$which is$0$for$x \le 0$and$e^{-1/x^2}$for $0<x$. One needs a way to put in an inflection point at$1/2$and have it be$1$for$x\ge 1\$. Perhaps Pietro's answer does this more elegantly.