Help proving the Weierstrass Approximation Theorem using Fejer's Theorem I found a series of steps designed to give a constructive proof of WAT using Fejer's Theorem.
For clarity, I'm using the following statement of WAT:


Let $[a,b]\subset\Bbb R$ and suppose that $f:[a,b]\to\Bbb R$ is continuous. Prove that for any $\varepsilon >0$, there is a polynomial $P:\Bbb R\to\Bbb R$ s. t. $|f(x)-P(x)|<\varepsilon\ \forall x\in [a,b]$.


First, I want to produce a continuous function $\overset{\sim}{f}: [a-1, b+1]\to\Bbb R$ so that $\overset{\sim}{f}(x) = f(x)\ \forall x\in [a,b]$ and $\overset{\sim}{f}(a-1)=\overset{\sim}{f}(b+1)$.
Second, I want to produce a continuous real function $g$ so that $g(x)=\overset{\sim}{f}(x)$ on $[a-1, b+1]$ and $g$ is $(2+b-a)$-periodic.
Third, I'll define $F(y)= g((2+b-a)\frac{y}{2\pi})$.
Fourth, I want to produce a trigonometric polynomial $T$ with $|T(y)-F(y)|<\frac{\varepsilon}2$. (I know that this is immediate from Fejer's Theorem.)
Fifth, I want to produce an actual polynomial $P$ so that $|P(y)-F(y)|<\varepsilon$ for any $y\in \left[\frac{2\pi(a-1)}{2+b-a}, \frac{2\pi(b+1)}{2+b-a}\right]$.
Last, I want to show that $\left|P(\frac{2\pi}{2+b-a})-f(x)\right|<\varepsilon$ for any $x\in [a,b]$.

I am pretty stuck on producing constructions for the first two steps and proving their desired properties.
As I indicated, the fourth step is clear, and it will give a trigonometric polynomial $T$ of the form $a_0+\sum\limits_{k=1}^{N}(a_k \cos(kt)+b_k\sin(kt))$. Then my idea for the fifth step is to produce $P$ by using the Taylor series expansions of sine and cosine to obtain a sequence of polynomials $(p_n)$ converging (uniformly ?) to $T$. Combining this with the fourth step should yield the fifth step, I think. But I'm not sure how to verify that this is true specifically on $\left[\frac{2\pi(a-1)}{2+b-a}, \frac{2\pi(b+1)}{2+b-a}\right]$.
Also, I'm unsure of how the last step is supposed to follow.

Am I on the right track? If so, I'd appreciate seeing how all the details are worked out. I'd also really appreciate it if responses could follow the steps directly, so that I can understand the process better.
 A: SKETCHY. You are on the right track. Assume that $a=1-\pi, b=\pi-1$: no generality is lost since you can always reduce to this case via a harmless affine change of variable. 

NOTE 1. The affine change of variables is the following: if $f$ is defined on $[a, b]$, then one should replace it with $$ F(x)=f\left[
 (\pi-1)\frac{x-a}{b-a} +(1-\pi)\frac{x-b}{a-b}\right].\Box$$

You have proven that, on the enlarged interval $[-\pi, \pi]$, the extension $\tilde f$ of $f$ (NOTE: I prefer not to use $f'$, easily mistaken for a derivative) is approximated by a trig polynomial
$$\tag{1}
|\tilde{f}(x)-T_m(x)|\le \frac\epsilon2,\quad T_m(x)=\sum_{k=-m}^m a_k^{(m)}e^{ikx}.$$
In your question, $T_m$ is called $T$ and it has the form 
$$\tag{2}
T(x)=a_0+\sum_{k=1}^m \left( a_k \cos(kt)+b_k\sin(kt)\right).$$ 

NOTE 2 This is a point in your question where you implicitly assume that $a=1-\pi, b=\pi-1$. On other intervals, trigonometric
  polynomials have different normalizations. On $[0, 1]$, for example,
  the trig polynomial $T$ given by (2) is not periodic.
This technical note set aside, we use Euler's formula and rewrite  $$
 T(x)=a_0+\sum_{k=1}^m\left( \frac{a_k-ib_k}{2} e^{ikt}
 +\frac{a_k+ib_k}{2}e^{-ikt}\right)$$ which is the exponential form of $T$.

We can therefore work with the trig polynomial $T_m$ given by (1), which has the advantage that it can be Taylor expanded easily, using the fact that 
$$\tag{3} e^{ikx}=\sum_{h=0}^\infty \frac{i^h k^h}{h!}x^h.$$ 
Inserting (3) into (1), we see that it makes sense to approximate $T_m$ with its truncated Taylor expansion
$$T^{n}_m(x)=\sum_{h=0}^n\sum_{k=-m}^m a_k^{(m)}\frac{i^h k^h}{h!}x^h.$$
We need to estimate
$$
|T_m(x)-T^n_m(x)|.$$
Show that, if you take $n$ sufficiently big, this is smaller than $\epsilon$. Use the fact that $|x|\le C$ (actually, $C=\pi$, but that's not important). (You will probably see the term 
$A_m=\sum_{k=-m}^m |a_k^{(m)}|$ appearing. )
