Polynomial in $D$ is surjective; is the image of a differential closed in $L^2$? Let $p(x)$ be a polynomial with complex coefficients and let $f$ be a smooth function from $\mathbb{R}$ to $\mathbb{C}$. Let $D$ be the differential operator. Then we can consider the linear map $p(D) \colon C^\infty(\mathbb{R}) \to C^\infty(\mathbb{R})$. I want to show that this is surjective.
It seems like the easiest way to tackle this is to assume that $p$ is linear, i.e. $p(D) = (D-a)$, whence by induction we'd be done if we could show that $D-a$ is surjective. So given $f$ we want to find $F$ with $DF - aF = f$. Define $F(x) = e^{ax}\int_1^x e^{-ay}f(y)dy$. Then $DF - aF = ae^{ax}\int_1^x e^{-ay}f(y)dy + e^{ax}e^{-ax}f(x) - ae^{ax}\int_1^x e^{-ay}f(y)dy = f(x)$ as required. This is not a thrilling proof (though I like the conjugation going on with the integral).
I was thinking about the following argument. It's straightforward that given any $a$ there is $g$ with $p(D)(g) = e^{ax}$. From Dirichlet's theorem we know that $f(x) = \sum a_k e^{ikx} = \lim_{k \to \infty} S_k(f)$ with $S_k(f)$ being the $k$-th partial Fourier sum. We know that $e^{ikx} \in \text{Im }p(D)$ hence $S_k$ is too. If we knew that Im $p(D)$ were closed in the $L^2$ norm on $C^\infty(\mathbb{R})$ (or Im $D-a$, equivalent by induction), we could conclude (as $S_k(f) \to f$ in $L^2$). How could I show this? Is it even true?
 A: I don't think that the attempt in the last paragraph is going to work. The space $C^\infty(\mathbb R)$ is not contained in $L^2(\mathbb R)$. Functions in $C^\infty(\mathbb R)$ need not be represented by Fourier series or Fourier transform (consider $f(x)=e^{x^2}$, for example).  
The surjectivity of $p(D)$ is a fancy way of saying that the ordinary differential equation $$p(D)F=f\tag1$$ has a solution $F\in C^\infty(\mathbb R)$ for any right-hand side $f\in C^\infty(\mathbb R)$. Let $n$ be the degree of polynomial $p$. Then (1) amounts to $n$ first-order linear equations with $n$ unknown functions $F, F', \dots, F^{(n-1)}$. The Peano existence theorem guarantees a $C^1$ smooth solution of this system. Unwinding this, we get $F\in C^n(\mathbb R) $ such that (1) holds. 
To conclude with $F\in C^\infty(\mathbb R)$, use a bootstrapping argument: according to (1), $F^{(n)}$ is a linear combination of lower-order derivatives of $F$, and of $f$. All these functions are at least $C^1$ smooth. Hence, $F^{(n)}$ is $C^1$ smooth, which means we improved the regularity to $F\in C^{n+1}(\mathbb R)$. This continues indefinitely. 
Alternatively, you can simply quote an ODE book in which the existence theorem is proved with the appropriate regularity statement.
