Let $f\colon[0,1]\to\mathbb{R}$ be continuous and $A$ a finite subset of $[0,1]$. Given $\epsilon>0$ is there a polynomial $p$ such that $$ |f(x)-p(x)|\le\epsilon\quad\forall x\in[0,1]\quad\text{and}\quad p(a)=f(a)\quad\forall a\in A? $$
This question arised while I was writing notes on Weierstrass's approximation theorem.
By considering the interpolating polynomial of $f$ on $A$, we may asume without loss of generality that $f(a)=0$ for all $a\in A$. There are three situations in which I know the answer to be in the positive.
- $A$ is a singleton, say $A=\{a\}$. There is a polynomial $q$ such that $|f(x)-q(x)|\le\epsilon/2$ for all $x\in[0,1]$. Since $f(0)=0$ we have $|q(a)|\le\epsilon/2$. Take $p(x)=q(x)-q(a)$.
- $A=\{0,1\}$. There is a polynomial $q$ such that $|f(x)-q(x)|\le\epsilon/2$ for all $x\in[0,1]$. Then $|q(0)|,|q(1)|\le\epsilon/2$. Take $p(x)=q(x)-q(0)(1-x)-q(1)\,x$.
- $f$ is differentiable at all $a\in A$ (with he usual understanding that if $a=0$ or $1$ we mean one-sided differentiability.) Let $P_A=\prod_{a\in A}(x-a)$ and $$ g(x)=\begin{cases}f(x)/P_A(x) & \text{if }x\notin A,\\f'(x)\Bigl(\prod\limits_{a\in A,a\ne x}(x-a)\Bigr)^{-1} & \text{if }x\in A.\end{cases} $$ The $g$ is continuous on $[0,1]$. Let $M$ be a bound of $P_A$ on $[0,1]$. There exists a polynomial $q$ such that $|g(x)-q(x)|\le\epsilon/M$ for all $x\in[0,1]$. Let $p(x)=P_A(x)\,q(x)$.
Do you know the answer for the general case?
Yes.
Say $||.||$ is the supremum norm on $[0,1]$. Fix $A=\{a_1,\dots,a_n\}$. Let $I_j$ be a polynomial with $I_j(a_j)=1$ and $I_j(a_k)=0$ for $k\ne j$. Now $||I_j||<\infty$, and it follows that there exists $c=c_A$ such that given $(b_1,\dots,b_n)$ there exists a polynomial $I_b$ with $I_b(a_j)=b_j$ and $$||I_b||\le c\max|b_j|.$$
So if $f$ is continuous and $p$ is a polynomial with $||f-p||<\epsilon$ then there exists a polynomial $q$ with $q(a_j)=f(a_j)$ and $$||f-q||<\epsilon+c\epsilon.$$