An application of the Weierstrass approximation theorem? Here is a problem that comes from my graduate school entrance exam. Unfortunately, I didn't solve it at the time, and even now, I still have no idea.
Let $f:[2,7]\rightarrow\mathbb{R}$ be continuous. Given $\varepsilon>0$, show that there is a polynomial $P$ such that
$$
P(2)=f(2),\quad P'(2)=0,\quad\text{and}\quad\sup\{|P(x)-f(x)|:x\in[2,7]\}<\varepsilon.
$$
Due to the way it states, I immediately thought of the so-called Weierstrass approximation theorem:
There is a polynomial $P$ such that $||P-f||_\infty<\varepsilon$,
where $||\cdot||_\infty$ denotes the sup norm. I'm eager to work this out. Any suggestion is welcomed. Thanks.
 A: For sake of convenience we may replace $[2,7]$ by $[0,1]$. $f(\sqrt x)$ is a continuous function on $[0,1]$, hence by Weierstrass theorem we may find a polynomial $Q(x)$ such that 
$$\sup_{x\in[0,1]}|f(\sqrt x)-Q(x)|<\epsilon/2$$
Let $P(x)=Q(x^2)+f(0)-Q(0)$. Then $P(x)$ is a polynomial satisfying $P(0)=f(0)$, $P'(0)=0$, and
\begin{align}
\sup_{x\in[0,1]}|f(x)-P(x)|&\le\sup_{x\in[0,1]}|f(x)-Q(x^2)|+|f(0)-Q(0)|\\
&=\sup_{\sqrt{x}\in[0,1]}|f(\sqrt x)-Q(x)|+|f(0)-Q(0)|\\
&=\sup_{x\in[0,1]}|f(\sqrt x)-Q(x)|+|f(0)-Q(0)|\\
&\le2\sup_{x\in[0,1]}|f(\sqrt x)-Q(x)|<\varepsilon
\end{align}
A: By Weierstrass theorem, we may find a polynomial $Q$ such that 
$$\sup_{x\in[2,7]}|f(x)-Q(x)|<\epsilon/2.$$
If $Q^\prime(2)= 0$, we’re done. Otherwise, denote $Q^\prime(2)=\alpha$ and consider the polynomials $P_{\alpha,n}(x)= \alpha x (1-x)^n$ defined on the interval $[0,1]$.
You’ll verify that $P_{\alpha,n}^\prime(0)= \alpha$ and $$\sup\limits_{x \in [0,1]} \vert P_{\alpha,n}(x) \vert \le \frac{\vert \alpha \vert}{n+1}.$$
Likewise $Q_{\alpha,n}(x) = P_{\alpha,n}(\frac{x-2}{5})$ is defined on $[2,7]$, $Q_{\alpha,n}^\prime(2) = \alpha/5$ and 
$$\sup\limits_{x \in [2,7]} \vert Q_{\alpha,n}(x) \vert \le \frac{\vert \alpha \vert}{n+1}.$$
Taking $\alpha =5 Q^\prime(2)$ and $n$ such that $\frac{\vert \alpha \vert}{n+1} \le \epsilon/2$, 
$$P(x)=Q(x)-Q_{\alpha,n}(x)$$ is a polynomial fulfilling the conditions you were looking for.
