[Math] Fourier cosine/sine series of $\cos x$

fourier analysisfourier seriespartial differential equations

The question in my textbook asks to solve for the cosine and sine fourier series of $f(x) = \cos x$ on the interval $[0, \pi/2]$. This is my first PDE class.

I tried integration by parts and got stuck so I tried just using the multiplication formula to work it out.

Sine-Series

$$ f(x) = \sum A_n \sin(\frac{n\pi x}{l})$$

Where,
$$A_n = \frac{2}{l}\int f(x) \sin(\frac{n \pi x}{l})dx$$
$$ = \frac{2}{\pi/2}\int_0^{\pi/2} f(x) \sin(\frac{n \pi x}{\pi/2})dx$$
$$ = \frac{4}{\pi}\int_0^{\pi/2} \cos(x) \sin(2n x)dx$$

$$ = \frac{4}{\pi} \int_0^{\pi/2} \frac{\sin(2nx+x) + \sin(2nx -x)}{2}dx$$
$$=\frac{2}{\pi}[-\frac{\cos(x(2n+1)}{2n+1} \vert_0^{\pi/2} -\frac{\cos(x(2n-1)}{2n-1} \vert_0^{\pi/2}] $$
$$ =\frac{2}{\pi}[-\frac{\cos((\frac{\pi}{2})(2n+1) + 1}{2n+1} -\frac{\cos((\frac{\pi}{2})(2n-1)+1}{2n-1}]$$

Would this be correct way to approach this problem? If so then I could figure out the cos-series myself. Any guidance is greatly appreciated.

Best Answer

Because you are working on the interval $[0,\pi/2]$, I would assume that the sin series would be in terms of $\{ \sin(2nx) : 1 \le n \lt \infty \}$ and the cos series would be in terms of $\{ \cos(2nx) : 0 \le n < \infty \}$. The function $\cos(x)$ can be expanded in either set of functions on $(0,\pi/2)$, though the sine series is not going to match at $0$ for obvious reasons: $$ \cos(x) \sim \sum_{n=1}^{\infty}A_n\sin(2 nx),\;\; 0 < x < \pi/2. $$ Multiply both sides by $\sin(2mx)$, integrate over $[0,\pi/2]$, and use the orthogonality of the $\sin(2 nx)$ on $[0,\pi/2]$ in order to isolate $A_n$: $$ \int_{0}^{\pi/2}\cos(x)\sin(2nx)dx=A_n\int_0^{\pi/2}\sin^2(2nx)dx \\ A_n = \frac{\int_0^{\pi/2}\cos(x)\sin(2nx)dx}{\int_0^{\pi/2}\sin^2(2nx)dx},\;\; n=1,2,3,\cdots. $$ Similarly $\cos(x)\sim\sum_{n=0}^{\infty}B_n\cos(2nx)dx$ where $$ B_n=\frac{\int_0^{\pi/2}\cos(x)\cos(2nx)dx}{\int_0^{\pi/2}\cos^2(2nx)dx},\;\; n=0,1,2,3,\cdots. $$ NOTE: The functions $\{ \sin(2nx) \}_{n=1}^{\infty}$ are, up to non-zero multipliers, the only non-zero solutions of the Sturm-Liouville problem $$ f''+\lambda f,\;\; 0 \le x \le \pi/2,\\ f(0)= 0,\;\; f(\pi/2)=0. $$ The functions $\{ \cos(2n x) \}_{n=1}^{\infty}$ are, up to non-zero multipliers, the only non-zero solutions of $$ f''+\lambda f,\;\; 0 \le x \le \pi/2, \\ f'(0)=0,\;\; f'(\pi/2)=0. $$ That's why these sets form complete orthogonal subsets of $L^2[0,\pi/2]$.