# What is the Fourier series of Dirichlet function?

Given the Dirichlet function defined as:

$$f(x) = \begin{cases}0 & x \in \mathbb{Q} \\ 1 & x \in \mathbb{R} \setminus \mathbb{Q}\end{cases}$$

Find the corresponding Fourier series.

Before starting, I believe that $f(x)$ is periodic for any real period greater than zero. Therefore I feel free to choose $2\pi$ as period. Hence the Fourier series will have the following form:

$$F(x) = a_0 + \sum_{n=1}^\infty a_n \cos nx + b_n \sin nx$$

With the following coefficients:

$$a_0 = \frac1{2\pi} \int_{-\pi}^\pi f(x) dx \\ a_n = \frac1\pi \int_{-\pi}^\pi f(x) \cos nx dx \\ b_n = \frac1\pi \int_{-\pi}^\pi f(x) \sin nx dx$$

My function is not Riemann-integrable, however is Lebesgue-integrable. Knowing the following theorem...

$$I = I_1 \cup I_2 \\ g(x) = \begin{cases}a & x \in I_1 \\ b & x \in I_2\end{cases} \\ \int_I g(x) dx = \int_{I_1} g(x) dx + \int_{I_2} g(x) dx$$

... I can easily calculate the coefficients $a_0 = 1, a_n = b_n = 0$. Therefore the Fourier series corresponding to the Dirichlet function is:

$$F(x) = 1$$

Which does not converge to the function.

This is what I discovered. Is my result exact? Is the procedure right?

• First of all, your function is not $2\pi$-periodic, but it is periodic with any rational period. Otherwise it looks fine.
– mrf
Dec 9, 2013 at 9:58

Suppose $f$ and $g$ are periodic of period $T$. Also suppose that $f$ is Lebesgue integrable on its period. If the set $\{x:f(x)\ne g(x)\}$ has Lebesgue measure zero, then the Fourier series of $g$ is the same as the Fourier series of $f$.
In your example $f$ is identically $1$, $g$ is the Dirichlet function, and $T$ can be any rational number.