I am trying to approximate the line $y=1$ by fourier series.
I can see a lot of examples where we define the domain for $x$.
However, Is it possible to define the series everywhere?
For example if $f(x)=1$ on $(0,5)$.
I can find the sine series $f(x)=\sum c_n \sin \frac{n\pi x}{5}$, where
$$c_n=2/5\int_0^5 \sin \frac{n\pi x}{5} dx$$
Similarly I can use cosine to find: $f(x)=c_0+\sum c_n \cos \frac{n\pi x}{5}$,
where
$$c_0=1/5\int_0^5 dx$$ and $$c_n=2/5 \int_0^5 \cos \frac{n\pi x}{5} dx$$
Is the above correct? That is I can use both, the sine or cosine on the $(0,5)$ interval.
However, if I extend the interval to $(-\infty, \infty) $ , since $f(x)=1$ is an even function, I will only get cosine terms.
Can somebody show me how to write the $f(x)=1$ for all $x$ in fourier series?
Best Answer
The Fourier series is just $f(x) = 1$. Recall, the Fourier series on $[-L, L]$ is given by $$f(x) = a_0 + \sum_{n} a_n \cos\left(\tfrac{n\pi x}{L} \right) + b_n\sin\left(\tfrac{n\pi x}{L} \right).$$ If you compute the coefficients using the integral fomulas, you'll find $a_0 = 1$, $a_n = b_n = 0$ for $n \ge 1$.
The whole idea of a Fourier series is to take a locally defined function and extend it periodically so that it is defined everywhere. It doesn't really make sense to take the Fourier series on $(-\infty, \infty)$. I think you may want to look into the Fourier transform. The Fourier transform can be is the analog to the Fourier series for a function defined on all of $(-\infty, \infty)$. But you're right, you need to think about the integrals converging. Indeed, for a function $f$, we define the Fourier transform of $f$ (sometimes denoted $\hat f$) by $$\hat f(\xi) = \int_{\mathbb R} e^{-2\pi i x \xi} f(x) dx.$$ Sometimes the definition is slightly different; for example, the $2\pi$ may not show up in the exponential and a constant may appear out front of the integral. Here, the integral will only exist if $$\int_{\mathbb R} \lvert f(x) \rvert dx < \infty.$$ Thus, for example, $f(x) = 1$ and $f(x) = x$ do not have Fourier transforms. But functions like $f(x) = e^{-\lvert x \rvert}$ and $f(x) = \frac{\sin^2(x)}{x^2}$ do have Fourier transforms. I'm sure if you google it, you can find many great resources to learn about this topic and its connection to Fourier series.