I was trying to find the Fourier cosine series of the function $\cos x$ in $[0, \pi]$. But I am getting all $a_n$ zero. How to proceed?
-
2Can you show your development ? – Mar 09 '16 at 11:10
-
You sure the terms are #all# zero? Doesn't the product cos $mx$ cos $nx$ have a different sort of antiderivative when $m=n$ versus otherwise? – Oscar Lanzi Mar 09 '16 at 11:19
-
1@Lanzi Sorry, I overlooked the case when $m=n$. Now I got $a_1=1$ and other $a_i$'s are zero. – user3575652 Mar 10 '16 at 10:51
-
1Note that if you approximate $f(x)$ with some collection of functions that includes $f(x)$ then it perfectly approximates itself. – CyclotomicField Jul 05 '18 at 04:03
3 Answers
$\cos\left(x\right)$ is itself a basis vector, so without any calculation you already know there is exactly one non-zero coefficient and its value is $1$... You can find that coefficient with a glance at the basis (and its numbering).
This question seems to have been answered in effect in comments, but here the answer is fleshed out in the "answer" section.
Under what seems to be the usual interpretation of a "Fourier cosine series", you treat the region of integration $[0,\pi]$ as just one half of the period of a periodic function, with the other half defined by the assumption that the function is even. When you have an even function with period $2\pi$ such as $\cos x,$ its Fourier cosine series on $[0,\pi]$ is identical to the Fourier series of the function on $[-\pi,\pi],$ which in turn can be computed by integrating over just the interval $[0,\pi].$ At least that's how I look at it.
The formula for the coefficients of the series (as shown in Wolfram Mathworld, for example), is $$ a_n = \frac2\pi \int_0^\pi f(x)\cos(n x) dx, $$ and setting $f(x) = \cos x,$ this formula gives $a_1 = 1.$
- 98,388
Don't forget the sine terms:
\begin{align*} f(x+2L) &= f(x) \\ f(x) &=\frac{a_{0}}{2}+ \sum_{n=1}^{\infty} \left( a_{n}\cos \frac{n\pi x}{L}+ b_{n}\sin \frac{n\pi x}{L} \right) \\ a_{n} &= \frac{1}{L}\int_{0}^{2L} f(t)\cos \frac{n\pi t}{L} dt \\ &= \frac{2}{\pi}\int_{0}^{\pi} \cos t \cos (2nt) dt \\ &= 0 \\ b_{n} &= \frac{1}{L}\int_{0}^{2L} f(t)\sin \frac{n\pi t}{L} dt \\ &= \frac{2}{\pi}\int_{0}^{\pi} \cos t \sin (2nt) dt \\ &= \frac{8n}{(4n^{2}-1)\pi} \end{align*}
- 18,990
-
"Fourier cosine series" implies a different formula, with $\cos(nt)$ instead of $\cos(t).$ See http://mathworld.wolfram.com/FourierCosineSeries.html – David K May 03 '18 at 00:28