Density of $\mathbb{Z}[x]$ in $\{f \in C([0,1],\mathbb{R}): f(0),f(1) \in \mathbb{Z} \}$ The problem:
Suppose $B=\{f \in C([0,1],\mathbb{R}): f(0),f(1) \in \mathbb{Z} \}$ and $A=\mathbb{Z}[x] \subset C([0,1],\mathbb{R})$.
I would like to prove that $\overline{A}=B$ with the $\|\cdot\|_{\infty}$ norm.
My attempt:
In the exercise there was an help which says that if $f \in B$ then $p_nf(x)=\sum_{0 \leq k \leq n} \left \lfloor{\binom{n}{k} f(\frac k n) }\right \rfloor x^k (1-x)^{n-k}$ converges uniformly to $f$ (then clearly $p_nf \in A$ and the exercise is finished).
I thought to estimate $||B_nf-p_nf||$ where $B_nf$ denote the Bernstein polynomial of $f$, i.e.
$$B_nf(x)=\sum_{0 \leq k \leq n} \binom{n}{k} f(\frac k n) x^k (1-x)^{n-k}$$
Update:
I would like to solve the exercise using the help given, i.e. proving that $p_nf$ converges uniformly to $f$
 A: Note that
\begin{align*}
\left| {B_n f(x) - p_n f(x)} \right| & = \left| {\sum\limits_{k = 0}^n {\left( {\binom{n}{k}f\left( {\frac{k}{n}} \right) - \left\lfloor {\binom{n}{k}f\left( {\frac{k}{n}} \right)} \right\rfloor } \right)x^k (1 - x)^{n - k} } } \right|
\\ &
 = \left| {\sum\limits_{k = 1}^{n - 1} {\left( {\binom{n}{k}f\left( {\frac{k}{n}} \right) - \left\lfloor {\binom{n}{k}f\left( {\frac{k}{n}} \right)} \right\rfloor } \right)x^k (1 - x)^{n - k} } } \right| \\ & \le \sum\limits_{k = 1}^{n - 1} {\left| {\binom{n}{k}f\left( {\frac{k}{n}} \right) - \left\lfloor {\binom{n}{k}f\left( {\frac{k}{n}} \right)} \right\rfloor } \right|x^k (1 - x)^{n - k} } 
\\ &
 \le \sum\limits_{k = 1}^{n - 1} {x^k (1 - x)^{n - k} }.
\end{align*}
The terms corresponding to $k=0$ and $k=n$ drop out since $f(0)$, $f(1)\in \mathbb{Z}$ and the binomial coefficients are of course integers. Now observe that
\begin{align*}
\sum\limits_{k = 1}^{n - 1} {x^k (1 - x)^{n - k} } & \le \frac{1}{n}\sum\limits_{k = 1}^{n - 1} {\binom{n}{k}x^k (1 - x)^{n - k} } \\ & \le \frac{1}{n}\sum\limits_{k = 0}^n {\binom{n}{k}x^k (1 - x)^{n - k} }  = \frac{1}{n}(x + (1 - x))^n  = \frac{1}{n}.
\end{align*}
I believe you can finish the proof from here.
