Polynomial approximation (Weierstrass' Theorem) with equality at the endpoints Let $f:\mathbb R \rightarrow\mathbb R $ be continuous, and choose $-\infty < a<b<\infty$ and $\epsilon > 0$. Show there exists a polynomial $p$ such that:
a) $p(a)=f(a),\; p(b)=f(b)$
b) $|f(t)-p(t)|<\epsilon$ for all $t\in [a,b]$
The second part is just Weierstrass approximation theorem. But the first part I didn't manage to get. I tried conjuring up a polynomial in the form
$$p=p_\epsilon+(\frac{a-x}{a-b})^Nf(b)+(\frac{b-x}{b-a})^Nf(a)$$
such that $p_\epsilon$ satisfies b by the theorem, and then play with constants to set bounds on the maximal error that the extra terms introduce (and also to cancel out $p_\epsilon$ at the bounds). I don't think this can work, since it eventually means that the extra terms are expected to approximate "some portion" of $f$, but given the fact that the proof to Weiersttrass' theorem is pretty complicated, I guess this isn't the way to go... How should I approach this properly? Thanks
 A: Let's do it first for the case $f(a) = f(b)=0.$ Find polynomials $P_n \to f$ uniformly on $[a,b].$ Then verfify that the polynomials
$$Q_n(x)=P_n(x)- P_n(a) -\frac{P_n(b)-P_n(a)}{b-a}(x-a)$$
converge to $f$ uniformly on $[a,b],$ with $Q_n(a) = Q_n(b) = 0$ for all $n.$
In the general case, let $l(x)$ be the linear function connecting $(a,f(a))$ to $(b,f(b)).$ Then $f(x) - l(x)$ equals $0$ at the endpoints. From the above we can find polynomials $Q_n \to f-l$ uniformly on $[a,b],$ with $Q_n(a)= Q_n(b) = 0.$ Now check that $Q_n + l$ satisfies the requirements.
A: You can prescribe equality of the functions at an arbitrary finite set of points ( derivatives too if you like). Let $P$ approximating $f$ by at most $\delta$. Your new polynomial should be 
$$P + Q$$ where $Q$ interpolates $f-P$ at the given points. The values of $f-P$ are all $\le \delta$. We can choose $\delta$ so that $Q$ does not exceed $\epsilon/2$ on the whole set. Make sure to take $\delta \le \epsilon/2$ also. Then $P+Q$ does not differ from $f$ by nore than $\epsilon$ and coincides with $f$ at the given points. 
