The question:
(a) Let $f$ be a continuous periodic complex valued function with period $2\pi $.Then prove that given $\epsilon >0,$ there exists a function $Q(x)=\sum_{k=-M}^{M}c_{k}e^{ikx}$ with $c_k\in \mathbb{C}$ and $M\in \mathbb{N}$ defined on $[-\pi ,\pi ]$ such that $\int_{-\pi }^{\pi }\left | f(x)-Q(x) \right |dx<\epsilon $.
(b)Suppose $f$ is a continuous function on $R^{1}$,$f(x+2\pi )=f(x)$, and $\frac{\alpha }{\pi }$ is irrational. Prove that $\lim_{n\rightarrow \infty }\frac{1}{N}\sum_{n=1}^{N}f(x+n\alpha )=\frac{1}{2\pi }\int_{-\pi }^{\pi }f(t)dt$
for every $x$. Hint: Do it first for $f(x)=e^{ikx}$.
My attempt:
(a) $f$ is continuous on $[-\pi ,\pi ]$, so $f$ is Riemann integrable on $[-\pi ,\pi ]$.
Given $\epsilon >0,$ there exists a continuous function g such that $\int_{-\pi}^{\pi}\left | f(x)-g(x) \right |dx<\epsilon $. I wonder how $Q(x)$ is approximated to $g(x)$ here.
(b) I used the hint and put $f(x)=e^{ikx}$ and found that both sides of the equality are $0$, but I don't know how to expand to the trigonometric polynomials and why the condition "$\frac{\alpha }{\pi }$ is irrational" is needed.
A) is a good exercise in using Stone-Weierstrass (https://en.wikipedia.org/wiki/Stone%E2%80%93Weierstrass_theorem). As noted in your attempt for any $\epsilon > 0$, there exists a $g$ continuous on $[-\pi,\pi]$ such that $ \int_{-\pi}^{\pi}|f(x)-g(x)| < \epsilon/2 $. Now by Stone-Weierstrass, we can uniformly approximate $g$ by a family of trigonometric polynomials. Indeed, this gives us a trigonometric polynomials on $[-\pi, \pi ]$ such that $\sup_{x}|\sum_{k=-N}^{N} a_ke^{ikx} - g(x)| < \epsilon/4 \pi$. Pulling all of these together with the triangle inequality, one has $ \int_{-\pi}^{\pi}|f(x)-\sum_{k=-N}^{N} a_ke^{ikx}| < \int_{-\pi}^{\pi}|f(x)-g(x)| + \int_{-\pi}^{\pi}|g(x)-\sum_{k=-N}^{N} a_ke^{ikx}| \leq \epsilon/2 + 2\pi*\epsilon/4\pi = \epsilon $ as desired.
B) After proving the hint, it should follow directly from A), as A) allows one to approximate any rieemen integrable function that is periodic with period $2\pi$ by a finite linear combination of $e^{ikx}$.