Q: Some questions about Weierstrass approximation theorem Im reading chapter11 of Carothers' Real Analysis, 1ed talking about Weierstrass Approximation Theorem. Here is an introduction,



*

*How to explain the "how" there?

*Since q is the polynomial approximating f with rational coefficients, that is to say there exist two approximation methods(precisely, one is p containing at leat one irrational coefficient and the other is q) or in other words, Weierstrass approximation theorem guarantee the existence of polynomial but not its coefficients being rational?


A: *

*This follows from the density of $\mathbb{Q}$ in $\mathbb{R}$. Let $p(x) = \sum_{k=0}^n a_k x^k$ be any polynomial with real coefficients and fix an $\epsilon > 0$. Note that for any $q(x) = \sum_{k=0}^n q_k x^k$ and any $x \in [a,b]$
$$
    |p(x) - q(x)| \leq \sum_{k=0}^n |a_k - q_k| |x|^k \leq \sum_{k=0}^n |a_k - q_k| M^k
$$
where $M = \max(|a|,|b|)$. So you can show that $\|p-q\|_\infty < \epsilon$ by, for each $k \in\{0,\ldots,n\}$, choosing a $q_k \in \mathbb{Q}$ such that
$$
    |a_k - q_k| < \frac{\epsilon}{(n+1)M^k}.
$$

*The way it's stated in the passage you've selected, no: the Weierstrass Approximation Theorem doesn't say anything about the coefficients of the approximating polynomials. However, we've just said quite a bit! In fact, it's not difficult to combine Weierstrass's theorem with 1. to conclude that $\mathbb{Q}[x]$ -- the set of polynomials with rational coefficients -- is dense in $C[a,b]$. Do you see how?
In fact, this is exactly what the author is saying when he points out that $C[a,b]$ is separable! I'm not sure how generally separability is defined in Carother, but a metric space $M$ is separable if it contains a subset $S$ such that


*

*$S$ is countable

*$S$ is dense in $M$ (i.e., every element of $M$ is the limit of a sequence $\{s_n\}$ of elements $s_n$ in $S$) under the metric within $M$


(Typically such a subset $S$ is called a countably dense subspace of $M$, naturally!)
Here $M = C[a,b]$ with norm $\|\cdot\|_\infty$ (or metric $d(f_1,f_2) = \|f_1-f_2\|_\infty$), and $S = \mathbb{Q}[x]$. If you can show that $\mathbb{Q}[x]$ is uniformly dense in $C[a,b]$ as I recommended above, then you've also shown that $C[a,b]$ is separable. (Side note: How do you know that $\mathbb{Q}[x]$ is countable? If you don't immediately see an argument, now would be a good time to prove that this is true.)
Edit: Here's how to conclude explicitly that $\mathbb{Q}[x]$ is dense in $C[a,b]$ given what we now know.
Let $f \in C[a,b]$. Assume $\{p_k\}$ is a sequence of polynomials converging uniformly to $f$ on the interval $[a,b]$. Accordingly, if we fix an $\epsilon > 0$, we know that there exists $K_\epsilon \in \mathbb{N}$ such that for all $k \geq K_\epsilon$
$$
    \|f - p_k\|_\infty < \epsilon/2.
$$
At the same time, by 1. we know that for each $k$ there exists a sequence $\{q_{k,i}\}$ of polynomials with coefficients in $\mathbb{Q}$ such that $q_{k,i} \to p_k$ uniformly on $[a,b]$ as $i \to \infty$. Hence for each $k$, there exists $I_{k,\epsilon} \in \mathbb{N}$ such that and for all $i \geq I_{k,\epsilon}$
$$
    \|p_k - q_{k,i}\|_\infty < \epsilon/2.
$$
Set $k = K_{\epsilon}$, set $i = I_{k,\epsilon}$, and then conclude that there exists a polynomial $q := q_{k,i}$ with rational coefficients such that
$$
    \|f - q\|_\infty = \|(f-p_k)+(p_k-q)\|_\infty \leq \|f-p_k\|_\infty + \|p_k - q\|_\infty < \epsilon/2 + \epsilon/2 = \epsilon.
$$
