TITLE: Writing $f\in L^2([-\pi,\pi])$ as a power series.
QUESTION [6 upvotes]: Consider the space $L^2([-\pi,\pi])$. I want to show that every function $f\in L^2([-\pi,\pi])$ can be written as a power series.
I remember a result that polynomials are dense in $L^2([-\pi,\pi])$. I thought about extending it (since power series are polynomials with infinite number of terms), but it is not clear how to do that. Density means that polynomials can get arbitrarily close to a function $f$, but here we want an exact representation.
(Note: See also my previous question)

REPLY [3 votes]: The Dirichlet function 
$$f(x)=\begin{cases}1 & x \in \mathbb Q \\0 & x \notin \mathbb Q \end{cases} $$
is in $L^2 ([-\pi,\pi])$, and nowhere analytic (i.e. it lacks a power series representation for all points).