Find all separable eigensolutions to the heat equation \(u_{t}=u_{xx}\) on \(0\leq x\leq \pi \) subject to (a) homogeneous boundary conditions \(u\left ( t,0\right ) =0,u\left ( t,\pi \right ) =0\). (b) mixed boundary conditions \(u\left ( t,0\right ) =0,u_{x}\left ( t,\pi \right ) =0\)
solution
Using separation of variables, let \(u\left ( t,x\right ) =T\left ( t\right ) X\left ( x\right ) \). Substituting this into \(u_{t}=u_{xx}\) gives \(T^{\prime }X=TX^{\prime \prime }\). Dividing by \(XT\neq 0\) results in\[ \frac{T^{\prime }}{T}=\frac{X^{\prime \prime }}{X}=-\lambda \]
Where \(\lambda \) is the seperation constant. The above gives the following ODE’s to solve\begin{align*} X^{\prime \prime }\left ( x\right ) +\lambda X\left ( x\right ) & =0\\ T^{\prime }\left ( t\right ) +\lambda T\left ( t\right ) & =0 \end{align*}
The boundary and initial conditions are transfered from the PDE to the ODE as shown below.
Using \(u\left ( t,0\right ) =0,u\left ( t,\pi \right ) =0\). Starting with the spatial ODE, and transferring the boundary conditions to the ODE results in\begin{align*} X^{\prime \prime }\left ( x\right ) +\lambda X\left ( x\right ) & =0\\ X\left ( 0\right ) & =0\\ X\left ( \pi \right ) & =0 \end{align*}
This is an eigenvalue boundary value ODE. The solution to the spatial ODE is
\begin{equation} X\left ( x\right ) =c_{1}e^{\sqrt{-\lambda }x}+c_{2}e^{-\sqrt{-\lambda }x} \tag{1} \end{equation}
case \(\lambda <0\)
Since \(\lambda <0\), then \(-\lambda \) is positive. Let \(\mu =-\lambda \), where \(\mu \) is positive. The above solution becomes
\[ X\left ( x\right ) =c_{1}e^{\sqrt{\mu }x}+c_{2}e^{-\sqrt{\mu }x}\]
Which can be written as
\[ X\left ( x\right ) =c_{1}\cosh \left ( \sqrt{\mu }x\right ) +c_{2}\sinh \left ( \sqrt{\mu }x\right ) \]
At \(x=0\) this gives\[ 0=c_{1}\] The solution now reduces to \(X\left ( x\right ) =c_{2}\sinh \left ( \sqrt{\mu }x\right ) \). At \(x=\pi \) this gives\[ 0=c_{2}\sinh \left ( \sqrt{\mu }\pi \right ) \] But \(\sinh \) is only zero when its argument is zero. Since \(\mu \neq 0\), then the only choice is that \(c_{2}=0\) also. But this gives trivial solution therefore \(\lambda <0\) is not an eigenvalue.
case \(\lambda =0\)
In this case the solution is \(X\left ( x\right ) =c_{1}+c_{2}x\). At \(x=0\) this gives \(0=c_{1}\). The solution becomes \(X\left ( x\right ) =c_{2}x\). At \(x=\pi \), this gives \(0=c_{2}\pi \). Therefore \(c_{2}=0\) also. This also gives the trivial solution. Hence \(\lambda =0\) is not an eigenvalue.
case \(\lambda >0\)
The solution in this case is
\begin{align*} X\left ( x\right ) & =c_{1}e^{\sqrt{-\lambda }x}+c_{2}e^{-\sqrt{-\lambda }x}\\ & =c_{1}e^{i\sqrt{\lambda }x}+c_{2}e^{-i\sqrt{\lambda }x} \end{align*}
Which can be rewritten as (the constants \(c_{1},c_{2}\) below will be different than the above \(c_{1},c_{2}\), but kept the same name for simplicity).
\[ X\left ( x\right ) =c_{1}\cos \left ( \sqrt{\lambda }x\right ) +c_{2}\sin \left ( \sqrt{\lambda }x\right ) \] At \(x=0\) this gives\[ 0=c_{1}\] The solution now reduces to \[ X\left ( x\right ) =c_{2}\sin \left ( \sqrt{\lambda }x\right ) \] At \(x=\pi \) this gives\[ 0=c_{2}\sin \left ( \sqrt{\lambda }\pi \right ) \] non-trivial solution requires that \(\sin \left ( \sqrt{\lambda }\pi \right ) =0\) which implies that \(\sqrt{\lambda }\pi =n\pi ,n=1,2,3,\cdots \). Hence eigenvalues are\[ \lambda _{n}=n^{2}\qquad n=1,2,3,\cdots \] And corresponding eigenfunctions are \[ \fbox{$X_n\left ( x\right ) =\sin \left ( nx\right ) \qquad n=1,2,3,\cdots $}\] Now that the eigenvalues and eigenfunction are found, the time ODE can be solved. The time ODE now becomes \[ T^{\prime }\left ( t\right ) +n^{2}T\left ( t\right ) =0 \] This is linear first order ode. The solution is \(T_{n}\left ( t\right ) =C_{n}e^{-n^{2}t}\). Therefore the fundamental solution is \begin{align*} u_{n}\left ( t,x\right ) & =C_{n}T_{n}\left ( t\right ) X_{n}\left ( x\right ) \\ & =C_{n}e^{-n^{2}t}\sin \left ( nx\right ) \end{align*}
Since this is a linear PDE, a linear combination of all fundamental solutions is a solution. Hence the general solution is\[ u\left ( t,x\right ) =\sum _{n=1}^{\infty }C_{n}e^{-n^{2}t}\sin \left ( nx\right ) \]
The constant \(C_{n}\) can be found if initial conditions are given.
Using \(u\left ( t,0\right ) =0,u_{x}\left ( t,\pi \right ) =0\). Starting with the spatial ODE, and transferring the boundary condition to \(X\), it becomes\begin{align*} X^{\prime \prime }\left ( x\right ) +\lambda X\left ( x\right ) & =0\\ X\left ( 0\right ) & =0\\ X^{\prime }\left ( \pi \right ) & =0 \end{align*}
This is an eigenvalue boundary value problem. The solution to the spatial ODE is
\begin{equation} X\left ( x\right ) =c_{1}e^{\sqrt{-\lambda }x}+c_{2}e^{-\sqrt{-\lambda }x} \tag{1} \end{equation}
case \(\lambda <0\)
Since \(\lambda <0\), then \(-\lambda \) is positive. Let \(\mu =-\lambda \), where \(\mu \) is positive. The solution becomes
\[ X\left ( x\right ) =c_{1}e^{\sqrt{\mu }x}+c_{2}e^{-\sqrt{\mu }x}\]
The above can be written as
\[ X\left ( x\right ) =c_{1}\cosh \left ( \sqrt{\mu }x\right ) +c_{2}\sinh \left ( \sqrt{\mu }x\right ) \]
At \(x=0\) this gives\[ 0=c_{1}\] Hence the solution now becomes\[ X\left ( x\right ) =c_{2}\sinh \left ( \sqrt{\mu }x\right ) \] Taking derivative gives\[ X^{\prime }\left ( x\right ) =c_{2}\sqrt{\mu }\cosh \left ( \sqrt{\mu }x\right ) \] And at \(x=\pi \) the above gives\[ 0=c_{2}\sqrt{\mu }\cosh \left ( \sqrt{\mu }\pi \right ) \] But \(\mu \neq 0\) and \(\cosh \) is never zero for any argument. Hence the only choice is that \(c_{2}=0\). This gives the trivial solution. Hence \(\lambda <0\) is not an eigenvalue.
case \(\lambda =0\)
In this case the solution is \(X\left ( x\right ) =c_{1}+c_{2}x\). At \(x=0\) this results in \(0=c_{1}\). The solution becomes \(X\left ( x\right ) =c_{2}x\). Hence \(X^{\prime }\left ( x\right ) =c_{2}\). At \(x=\pi \), this implies \(0=c_{2}\pi \). Therefore \(c_{2}=0\) also. This gives the trivial solution. Hence \(\lambda =0\) is not an eigenvalue.
case \(\lambda >0\)
The solution in this case is
\begin{align*} X\left ( x\right ) & =c_{1}e^{\sqrt{-\lambda }x}+c_{2}e^{-\sqrt{-\lambda }x}\\ & =c_{1}e^{i\sqrt{\lambda }x}+c_{2}e^{-i\sqrt{\lambda }x} \end{align*}
Which can be rewritten as (the constants \(c_{1},c_{2}\) below will be different than the above \(c_{1},c_{2}\), but kept the same name for simplicity).
\[ X\left ( x\right ) =c_{1}\cos \left ( \sqrt{\lambda }x\right ) +c_{2}\sin \left ( \sqrt{\lambda }x\right ) \]
At \(x=0\) this gives\[ 0=c_{1}\] The solution now reduces to\[ X\left ( x\right ) =c_{2}\sin \left ( \sqrt{\lambda }x\right ) \] Therefore\[ X^{\prime }\left ( x\right ) =\sqrt{\lambda }c_{2}\cos \left ( \sqrt{\lambda }x\right ) \] At \(x=\pi \)\[ 0=\sqrt{\lambda }c_{2}\cos \left ( \sqrt{\lambda }\pi \right ) \] Non-trivial solution requires that \(\cos \left ( \sqrt{\lambda }\pi \right ) =0\), which implies \(\sqrt{\lambda }\pi =\frac{n\pi }{2},n=1,3,5,\cdots \). or \(\sqrt{\lambda }=\frac{n}{2},n=1,3,5,\cdots \). Therefore the eigenvalues are\[ \lambda _{n}=\left ( \frac{n}{2}\right ) ^{2}\qquad n=1,3,5,\cdots \] Or\[ \lambda _{n}=\left ( \frac{2n-1}{2}\right ) ^{2}\qquad n=1,2,3,\cdots \] Few eigenvalues are \(\lambda =\left \{ \frac{1}{4},\frac{9}{4},\frac{25}{4},\cdots \right \} \). The corresponding eigenfunctions are \[ \fbox{$X_n\left ( x\right ) =\sin \left ( \frac{2n-1}{2}x\right ) \qquad n=1,2,3,\cdots $}\] Now that the eigenvalues and eigenfunction are found, the time ODE is solved. The time ODE now becomes \[ T^{\prime }\left ( t\right ) +\left ( \frac{2n-1}{2}\right ) ^{2}T\left ( t\right ) =0 \] This is linear first order ode. The solution is \(T_{n}\left ( t\right ) =C_{n}e^{-\left ( \frac{2n-1}{2}\right ) ^{2}t}\). Therefore the fundamental solution is \begin{align*} u_{n}\left ( t,x\right ) & =C_{n}T_{n}\left ( t\right ) X_{n}\left ( x\right ) \\ & =C_{n}e^{-\left ( \frac{2n-1}{2}\right ) ^{2}t}\sin \left ( \frac{2n-1}{2}x\right ) \end{align*}
A linear combination of all fundamental solution is a solution (due to linearity). Hence the general solution is\[ u\left ( t,x\right ) =\sum _{n=1}^{\infty }C_{n}e^{-\left ( \frac{2n-1}{2}\right ) ^{2}t}\sin \left ( \frac{2n-1}{2}x\right ) \]
(a) Find the real eigensolutions to the damped heat equation \(u_{t}=u_{xx}-u\). (b) Which solutions satisfy the periodic boundary conditions \(u\left ( t,-\pi \right ) =u\left ( t,\pi \right ) ,u_{x}\left ( t,-\pi \right ) =u_{x}\left ( t,\pi \right ) \) ?
solution
Using separation of variables, Let \(u\left ( t,x\right ) =T\left ( t\right ) X\left ( x\right ) \). Substituting this into \(u_{t}+u=u_{xx}\) gives \(T^{\prime }X+TX=TX^{\prime \prime }\). Dividing by \(XT\neq 0\) gives\[ \frac{T^{\prime }}{T}+1=\frac{X^{\prime \prime }}{X}=-\lambda \] Where \(\lambda \) is the separation constant. This gives the following ODE’s to solve\begin{align*} X^{\prime \prime }\left ( x\right ) +\lambda X\left ( x\right ) & =0\\ T^{\prime }\left ( t\right ) +\left ( \lambda +1\right ) T\left ( t\right ) & =0 \end{align*}
Eigenfunctions are solutions to the spatial ODE. \begin{equation} X\left ( x\right ) =c_{1}e^{\sqrt{-\lambda }x}+c_{2}e^{-\sqrt{-\lambda }x} \tag{1} \end{equation} To determine the actual eigenfunctions and eigenvalues, boundary conditions are used. This is part b below.
Using \(u\left ( t,-\pi \right ) =u\left ( t,\pi \right ) ,u_{x}\left ( t,-\pi \right ) =u_{x}\left ( t,\pi \right ) \). Starting with the spatial ODE above, and transferring the boundary condition to \(X\) gives\begin{align*} X^{\prime \prime }\left ( x\right ) +\lambda X\left ( x\right ) & =0\\ X\left ( -\pi \right ) & =X\left ( \pi \right ) \\ X^{\prime }\left ( -\pi \right ) & =X^{\prime }\left ( \pi \right ) \end{align*}
This is an eigenvalue boundary value problem. The solution is\begin{equation} X\left ( x\right ) =c_{1}e^{\sqrt{-\lambda }x}+c_{2}e^{-\sqrt{-\lambda }x} \tag{1} \end{equation} case \(\lambda <0\)
Since \(\lambda <0\), then \(-\lambda \) is positive. Let \(\mu =-\lambda \), where \(\mu \) is now positive. The solution (1) becomes\[ X\left ( x\right ) =c_{1}e^{\sqrt{\mu }x}+c_{2}e^{-\sqrt{\mu }x}\] The above can be written as\begin{equation} X\left ( x\right ) =c_{1}\cosh \left ( \sqrt{\mu }x\right ) +c_{2}\sinh \left ( \sqrt{\mu }x\right ) \tag{2} \end{equation} Applying first B.C. \(X\left ( -\pi \right ) =X\left ( \pi \right ) \) using (2) gives\begin{align*} c_{1}\cosh \left ( \sqrt{\mu }\pi \right ) +c_{2}\sinh \left ( -\sqrt{\mu }\pi \right ) & =c_{1}\cosh \left ( \sqrt{\mu }\pi \right ) +c_{2}\sinh \left ( \sqrt{\mu }\pi \right ) \\ c_{2}\sinh \left ( -\sqrt{\mu }\pi \right ) & =c_{2}\sinh \left ( \sqrt{\mu }\pi \right ) \end{align*}
But \(\sinh \) is only zero when its argument is zero which is not the case here. Therefore the above implies that \(c_{2}=0\) as only possibility to satisfy the above equation. The solution (2) now reduces to\begin{equation} X\left ( x\right ) =c_{1}\cosh \left ( \sqrt{\mu }x\right ) \tag{3} \end{equation} Taking derivative\begin{equation} X^{\prime }\left ( x\right ) =c_{1}\sqrt{\mu }\sinh \left ( \sqrt{\mu }x\right ) \tag{4} \end{equation} Applying the second BC \(X^{\prime }\left ( -\pi \right ) =X^{\prime }\left ( \pi \right ) \) gives\[ c_{1}\sqrt{\mu }\sinh \left ( -\sqrt{\mu }\pi \right ) =c_{1}\sqrt{\mu }\sinh \left ( \sqrt{\mu }x\right ) \] But \(\sinh \) is only zero when its argument is zero which is not the case here. Therefore the above implies that \(c_{1}=0\). This means a trivial solution. Therefore \(\lambda <0\) is not an eigenvalue.
case \(\lambda =0\)
In this case the solution is \(X\left ( x\right ) =c_{1}+c_{2}x\). Applying first BC \(X\left ( -\pi \right ) =X\left ( \pi \right ) \) gives\begin{align*} c_{1}-c_{2}\pi & =c_{1}+c_{2}\pi \\ -c_{2}\pi & =c_{2}\pi \end{align*}
This gives \(c_{2}=0\). The solution now becomes \[ X\left ( x\right ) =c_{1}\] Therefore \(X^{\prime }\left ( x\right ) =0\). Applying the second boundary conditions \(X^{\prime }\left ( -\pi \right ) =X^{\prime }\left ( \pi \right ) \) is now satisfied for any \(c_{1}\), since it gives (\(0=0\)). Therefore \(\lambda =0\) is an eigenvalue with eigenfunction \(X_{0}\left ( 0\right ) =1\) (selecting \(c_{1}=1\) since any arbitrary constant will work).
case \(\lambda >0\)
The solution in this case is \begin{align*} X\left ( x\right ) & =c_{1}e^{\sqrt{-\lambda }x}+c_{2}e^{-\sqrt{-\lambda }x}\\ & =c_{1}e^{i\sqrt{\lambda }x}+c_{2}e^{-i\sqrt{\lambda }x} \end{align*}
Which can be rewritten as (the constants \(c_{1},c_{2}\) below will be different than the above \(c_{1},c_{2}\), but kept the same name for simplicity).\begin{equation} X\left ( x\right ) =c_{1}\cos \left ( \sqrt{\lambda }x\right ) +c_{2}\sin \left ( \sqrt{\lambda }x\right ) \tag{5} \end{equation} Applying first B.C. \(X\left ( -\pi \right ) =X\left ( \pi \right ) \) using the above gives\begin{align*} c_{1}\cos \left ( \sqrt{\lambda }\pi \right ) +c_{2}\sin \left ( -\sqrt{\lambda }\pi \right ) & =c_{1}\cos \left ( \sqrt{\lambda }\pi \right ) +c_{2}\sin \left ( \sqrt{\lambda }\pi \right ) \\ c_{2}\sin \left ( -\sqrt{\lambda }\pi \right ) & =c_{2}\sin \left ( \sqrt{\lambda }\pi \right ) \end{align*}
There are two choices here. Either \(c_{2}=0\) or \(\sqrt{\lambda }\pi =n\pi ,n=1,2,3,\cdots \). Using the second choice for now, which implies that \[ \lambda _{n}=n^{2}\qquad n=1,2,3,\cdots \] And now we will now look to see what happens using the second BC with the above choice. The solution (5) now becomes\[ X\left ( x\right ) =c_{1}\cos \left ( nx\right ) +c_{2}\sin \left ( nx\right ) \qquad n=1,2,3,\cdots \] Therefore\[ X^{\prime }\left ( x\right ) =-c_{1}n\sin \left ( nx\right ) +c_{2}n\cos \left ( nx\right ) \] Applying the second BC \(X^{\prime }\left ( -\pi \right ) =X^{\prime }\left ( \pi \right ) \) using the above gives\begin{align*} c_{1}n\sin \left ( n\pi \right ) +c_{2}n\cos \left ( n\pi \right ) & =-c_{1}n\sin \left ( n\pi \right ) +c_{2}n\cos \left ( n\pi \right ) \\ c_{1}n\sin \left ( n\pi \right ) & =-c_{1}n\sin \left ( n\pi \right ) \\ 0 & =0 \end{align*}
Since \(n\) is integer.
Therefore this means that using the choice \(\lambda _{n}=n^{2}\) satisfied both boundary conditions with \(c_{2}\neq 0,c_{1}\neq 0\). This means the solution (5) is\[ X_{n}\left ( x\right ) =A_{n}\cos \left ( nx\right ) +B_{n}\sin \left ( nx\right ) \qquad \qquad n=1,2,3,\cdots \] The above says that there are two eigenfunctions in this case. They are \[ X_{n}\left ( x\right ) =\left \{ \begin{array} [c]{c}\cos \left ( nx\right ) \\ \sin \left ( nx\right ) \end{array} \right . \] Recalling that there is also a zero eigenvalue with constant as its eigenfunction, then the complete set of eigenfunctions is\[ X_{n}\left ( x\right ) =\left \{ \begin{array} [c]{c}1\\ \cos \left ( nx\right ) \\ \sin \left ( nx\right ) \end{array} \right . \] Now that the eigenvalues are found, the solution to the time ODE can be found. The time ODE from above was found to be \[ T^{\prime }\left ( t\right ) +\left ( \lambda +1\right ) T\left ( t\right ) =0 \] For the zero eigenvalue case, the above reduces to \(T^{\prime }\left ( t\right ) +T\left ( t\right ) =0\) which has the solution \(T_{0}\left ( t\right ) =C_{0}e^{-t}\). For non zero eigenvalues \(\lambda _{n}=n^{2}\), the ODE becomes \(T^{\prime }\left ( t\right ) +\left ( n^{2}+1\right ) T\left ( t\right ) =0\), whose solution is \(T_{0}\left ( t\right ) =C_{n}e^{-\left ( n^{2}+1\right ) t}\).
Putting all the above together, gives the fundamental solution as\[ u_{n}\left ( t,x\right ) =\left \{ \begin{array} [c]{c}C_{0}e^{-t}\\ C_{n}\cos \left ( nx\right ) e^{-\left ( n^{2}+1\right ) t}\qquad \qquad n=1,2,3,\cdots \\ B_{n}\sin \left ( nx\right ) e^{-\left ( n^{2}+1\right ) t}\qquad \qquad n=1,2,3,\cdots \end{array} \right . \] The complete solution is the sum of the above solutions \[ u\left ( t,x\right ) =C_{0}e^{-t}+\sum _{n=1}^{\infty }e^{-\left ( n^{2}+1\right ) t}\left ( C_{n}\cos \left ( nx\right ) +B_{n}\sin \left ( nx\right ) \right ) \] The constants \(C_{0},C_{n},B_{n}\) can be found from initial conditions.
(d) Find the Fourier series of the following functions \(f\left ( x\right ) =x^{2}\) (using \(-\pi \leq x\leq \pi \) )
solution
The Fourier series is given by
\[ x^{2}\sim \frac{a_{0}}{2}+\sum _{n=1}^{\infty }a_{n}\cos \left ( \frac{2\pi }{T}nx\right ) +a_{n}\sin \left ( \frac{2\pi }{T}nx\right ) \] Where \(T\) is the period of \(f\left ( x\right ) \). Taking this period to be \(2\pi \), the above simplifies to\[ x^{2}\sim \frac{a_{0}}{2}+\sum _{n=1}^{\infty }a_{n}\cos \left ( nx\right ) +b_{n}\sin \left ( nx\right ) \] The function \(x^{2}\) is even, hence all \(b_{n}\) are zero. The above becomes\begin{equation} x^{2}\sim \frac{a_{0}}{2}+\sum _{n=1}^{\infty }a_{n}\cos \left ( nx\right ) \tag{1} \end{equation} But\begin{align*} a_{0} & =\frac{1}{\pi }\int _{-\pi }^{\pi }x^{2}dx\\ & =\frac{2}{\pi }\int _{0}^{\pi }x^{2}dx\\ & =\frac{2}{\pi }\left [ \frac{x^{3}}{3}\right ] _{0}^{\pi }\\ & =\frac{2}{3\pi }\pi ^{3}\\ & =\frac{2}{3}\pi ^{2} \end{align*}
And\begin{align} a_{n} & =\frac{1}{\pi }\int _{-\pi }^{\pi }x^{2}\cos \left ( nx\right ) dx\nonumber \\ & =\frac{2}{\pi }\int _{0}^{\pi }x^{2}\cos \left ( nx\right ) dx \tag{1A} \end{align}
Let \(I=\int _{0}^{\pi }x^{2}\cos \left ( nx\right ) dx\). Using integration by parts \(\int udv=uv-\int vdu\). Let \(u=x^{2},dv=\cos \left ( nx\right ) \). Then \(du=2x,v=\frac{\sin \left ( nx\right ) }{n}\). Hence\begin{align*} I & =\left [ x^{2}\frac{\sin \left ( nx\right ) }{n}\right ] _{0}^{\pi }-2\int _{0}^{\pi }x\frac{\sin \left ( nx\right ) }{n}dx\\ & =\overset{0}{\overbrace{\frac{1}{n}\left [ x^{2}\sin \left ( nx\right ) \right ] _{0}^{\pi }}}-\frac{2}{n}\int _{0}^{\pi }x\sin \left ( nx\right ) dx\\ & =-\frac{2}{n}\int _{0}^{\pi }x\sin \left ( nx\right ) dx \end{align*}
Integration by parts again. \(u=x,dv=\sin \left ( nx\right ) \), then \(du=1,v=-\frac{\cos \left ( nx\right ) }{n}\). The above becomes\begin{align*} I & =-\frac{2}{n}\left ( \left [ -x\frac{\cos \left ( nx\right ) }{n}\right ] _{0}^{\pi }-\int _{0}^{\pi }-\frac{\cos \left ( nx\right ) }{n}dx\right ) \\ & =-\frac{2}{n}\left ( -\frac{1}{n}\left [ x\cos \left ( nx\right ) \right ] _{0}^{\pi }+\frac{1}{n}\int _{0}^{\pi }\cos \left ( nx\right ) dx\right ) \\ & =\frac{2}{n^{2}}\left ( \left [ x\cos \left ( nx\right ) \right ] _{0}^{\pi }-\int _{0}^{\pi }\cos \left ( nx\right ) dx\right ) \\ & =\frac{2}{n^{2}}\left ( \left [ \pi \cos \left ( n\pi \right ) \right ] -\left [ \frac{\sin \left ( nx\right ) }{n}\right ] _{0}^{\pi }\right ) \\ & =\frac{2\pi }{n^{2}}\cos \left ( n\pi \right ) \\ & =\frac{2\pi }{n^{2}}\left ( -1\right ) ^{n} \end{align*}
The above is \(I\). Substituting this result back in (1A) gives\begin{align*} a_{n} & =\frac{2}{\pi }I\\ & =\frac{2}{\pi }\frac{2\pi }{n^{2}}\left ( -1\right ) ^{n}\\ & =\frac{4}{n^{2}}\left ( -1\right ) ^{n} \end{align*}
Therefore (1) becomes\[ x^{2}\sim \frac{1}{3}\pi ^{2}+4\sum _{n=1}^{\infty }\frac{\left ( -1\right ) ^{n}}{n^{2}}\cos \left ( nx\right ) \] To verify this result, the Fourier series was compared to \(x^{2}\) for an increasing number of terms to see if it converged to \(x^{2}\). Here is the result. This shows the convergence is fast, after 6 terms only the approximation (in red color) is almost the same as the original function \(x^{2}\).
the following plot shows how the Fourier series approximation to \(x^{2}\) when it is periodically extended to outside \(\left [ -\pi ,\pi \right ] \). This uses the range \(\left [ -3\pi ,3\pi \right ] \) by adding one period to left and one period to the right.
(d) Find the Fourier series of the following function \(f\left ( x\right ) =\left \{ \begin{array} [c]{ccc}x & & \left \vert x\right \vert <\frac{\pi }{2}\\ 0 & & \text{otherwise}\end{array} \right . \)
solution
This is plot showing \(f\left ( x\right ) \)
The Fourier series is given by\[ f\left ( x\right ) \sim \frac{a_{0}}{2}+\sum _{n=1}^{\infty }a_{n}\cos \left ( \frac{2\pi }{T}nx\right ) +a_{n}\sin \left ( \frac{2\pi }{T}nx\right ) \] Where \(T\) is the period of the function to be approximated. Taking this period to be \(2\pi \), the above simplifies to\[ f\left ( x\right ) \sim \frac{a_{0}}{2}+\sum _{n=1}^{\infty }a_{n}\cos \left ( nx\right ) +b_{n}\sin \left ( nx\right ) \] The function \(f\left ( x\right ) \) is odd then all \(a_{n}\) will zero. The above simplifies to\[ f\left ( x\right ) \sim \sum _{n=1}^{\infty }b_{n}\sin \left ( nx\right ) \] Where\begin{align*} b_{n} & =\frac{1}{\pi }\int _{-\pi }^{\pi }f\left ( x\right ) \sin \left ( nx\right ) dx\\ & =\frac{1}{\pi }\int _{-\frac{\pi }{2}}^{\frac{\pi }{2}}x\sin \left ( nx\right ) dx \end{align*}
But \(x\) is odd and \(\sin \left ( x\right ) \) is odd, hence the product is even. The above simplifies to \[ b_{n}=\frac{2}{\pi }\int _{0}^{\frac{\pi }{2}}x\sin \left ( nx\right ) dx \] Using integration by parts \(\int udv=uv-\int vdu\). Let \(x=u,du=1,dv=\sin \left ( nx\right ) ,v=\frac{-\cos \left ( nx\right ) }{n}\), the above gives\begin{align*} b_{n} & =\frac{2}{\pi }\left ( \frac{-1}{n}\left [ x\cos \left ( nx\right ) \right ] _{0}^{\frac{\pi }{2}}+\frac{1}{n}\int _{0}^{\frac{\pi }{2}}\cos \left ( nx\right ) dx\right ) \\ & =\frac{2}{\pi n}\left ( -\left [ x\cos \left ( nx\right ) \right ] _{0}^{\frac{\pi }{2}}+\int _{0}^{\frac{\pi }{2}}\cos \left ( nx\right ) dx\right ) \\ & =\frac{2}{\pi n}\left ( -\left [ \frac{\pi }{2}\cos \left ( n\frac{\pi }{2}\right ) \right ] +\frac{1}{n}\left [ \sin \left ( nx\right ) \right ] _{0}^{\frac{\pi }{2}}\right ) \\ & =\frac{2}{\pi n}\left ( -\left [ \frac{\pi }{2}\cos \left ( n\frac{\pi }{2}\right ) \right ] +\frac{1}{n}\left [ \sin \left ( n\frac{\pi }{2}\right ) \right ] \right ) \\ & =\frac{2}{\pi n^{2}}\left ( \sin \left ( n\frac{\pi }{2}\right ) -\frac{n\pi }{2}\cos \left ( n\frac{\pi }{2}\right ) \right ) \end{align*}
Therefore the Fourier series becomes\[ f\left ( x\right ) \sim \sum _{n=1}^{\infty }\frac{2}{\pi n^{2}}\left ( \sin \left ( \frac{n\pi }{2}\right ) -\frac{1}{2}n\pi \cos \left ( \frac{n\pi }{2}\right ) \right ) \sin \left ( nx\right ) \] To verify this result, the Fourier series was compared to \(f\left ( x\right ) \) for increasing number of terms to see if it converges to \(x^{2}\). Here is the result. This shows the convergence is fast, but not as fast as last problem due to jump discontinuity in \(f\left ( x\right ) \). 10 terms are used below.
the following plot shows how the Fourier series approximate \(f\left ( x\right ) \) when it is periodically extended to outside \(\left [ -\pi ,\pi \right ] \). This uses the range \(\left [ -3\pi ,3\pi \right ] \) by adding one more period to left and to the right.
Find the Fourier series of \(\sin ^{2}x\) and \(\cos ^{2}x\) without directly calculating the Fourier coefficients.
solution
Using the known trig identity\begin{equation} \sin ^{2}x=\frac{1}{2}-\frac{1}{2}\cos \left ( 2x\right ) \tag{1} \end{equation} And comparing the the above to the Fourier series expansion\begin{equation} \sin ^{2}x=\frac{a_{0}}{2}+\left ( a_{1}\cos \left ( x\right ) +a_{2}\cos \left ( 2x\right ) +a_{3}\cos \left ( 3x\right ) +\cdots \right ) +\left ( b_{1}\sin \left ( x\right ) +b_{2}\sin \left ( 2x\right ) +b_{3}\sin \left ( 3x\right ) +\cdots \right ) \tag{A} \end{equation} Shows that \(\frac{a_{0}}{2}=\frac{1}{2}\) and \(a_{2}=\frac{-1}{2}\) and all other terms are zero. Because the Fourier series is unique for a function, then (1) is the Fourier series for \(\sin ^{2}x\).
Similarly, Using the known trig identity\begin{equation} \cos ^{2}x=\frac{1}{2}+\frac{1}{2}\cos \left ( 2x\right ) \tag{2} \end{equation} And comparing the the above to the Fourier series expansion (A), shows that \(\frac{a_{0}}{2}=\frac{1}{2}\) and \(a_{2}=\frac{1}{2}\) and all other terms are zero. Therefore (2) is the Fourier series expansion for \(\cos ^{2}x\).
Graph the \(2\pi \) periodic extension of each of the following functions (h) \(f\left ( x\right ) =\frac{1}{x}\). Which extension are continuous? Differentiable?
solution
The original function \(f\left ( x\right ) =\frac{1}{x}\) is always taken from \(-\pi \leq x\leq \pi \) (before extending it periodically). At \(x=0\) the function is not defined.
Periodically extending it, it becomes (showing one extra period to the left and right) then following
Looking at the above plot shows the extension is not continuous and also not Differentiable due to jump discontinuities.
Suppose that \(f\left ( x\right ) \) is periodic with period \(T\) (using \(T\) instead of \(l\) as in book as it is more clear). Prove that for any \(a\) (a) \(\int _{a}^{a+T}f\left ( x\right ) dx=\int _{0}^{T}f\left ( x\right ) dx\). (b) \(\int _{0}^{T}f\left ( x+a\right ) dx=\int _{0}^{T}f\left ( x\right ) dx\)
solution
\[ \int _{a}^{a+T}f\left ( x\right ) dx-\int _{0}^{T}f\left ( x\right ) dx=\overset{\int _{a}^{a+T}f\left ( x\right ) dx}{\overbrace{\left ( \int _{a}^{T}f\left ( x\right ) dx+\int _{T}^{a+T}f\left ( x\right ) dx\right ) }}-\overset{\int _{0}^{T}f\left ( x\right ) dx}{\overbrace{\left ( \int _{0}^{a}f\left ( x\right ) dx+\int _{a}^{T}f\left ( x\right ) dx\right ) }}\] Simplifying the RHS above gives\begin{equation} \int _{a}^{a+T}f\left ( x\right ) dx-\int _{0}^{T}f\left ( x\right ) dx=\int _{T}^{a+T}f\left ( x\right ) dx-\int _{0}^{a}f\left ( x\right ) dx\tag{1} \end{equation} But \begin{equation} \int _{T}^{a+T}f\left ( x\right ) dx=\int _{0}^{a}f\left ( x+T\right ) dx\tag{2} \end{equation} To show how Eq(2) was derived: Let \(u=x-T\). Then \(du=dx\). When \(x=T\) then \(u=0\). When \(x=a+T\) then \(u=a\). Hence \(\int _{T}^{a+T}f\left ( x\right ) dx=\int _{0}^{a}f\left ( u+T\right ) du\). But \(u\) is arbitrary integral variable. Renaming it back to \(x\) gives that \(\int _{T}^{a+T}f\left ( x\right ) dx=\int _{0}^{a}f\left ( x+T\right ) dx\).
Now, substituting (2) back into RHS of (1) gives\begin{align*} \int _{a}^{a+T}f\left ( x\right ) dx-\int _{0}^{T}f\left ( x\right ) dx & =\int _{0}^{a}f\left ( x+T\right ) dx-\int _{0}^{a}f\left ( x\right ) dx\\ & =\int _{0}^{a}f\left ( x+T\right ) -f\left ( x\right ) dx \end{align*}
But since \(f\left ( x\right ) \) is periodic, then \(f\left ( x+T\right ) =f\left ( x\right ) \). Therefore the RHS above is zero. \begin{align*} \int _{a}^{a+T}f\left ( x\right ) dx-\int _{0}^{T}f\left ( x\right ) dx & =0\\ \int _{a}^{a+T}f\left ( x\right ) dx & =\int _{0}^{T}f\left ( x\right ) dx \end{align*}
Which is what the problem is asking to show.
Starting by rewriting \(\int _{0}^{T}f\left ( x+a\right ) dx\) as the following. Let \(u=x+a\). Hence \(du=dx\). When \(x=0,u=a\) and when \(x=T,u=a+T\). The integral becomes \(\int _{a}^{a+T}f\left ( u\right ) du\). But now \(u\) is arbitrary integration variable. Renaming is back to \(x\) then we obtain that\begin{equation} \int _{0}^{T}f\left ( x+a\right ) dx=\int _{a}^{a+T}f\left ( x\right ) dx \tag{1} \end{equation} Now, to show that main result, considering \[ \int _{0}^{T}f\left ( x+a\right ) dx-\int _{0}^{T}f\left ( x\right ) dx=\int _{a}^{a+T}f\left ( x\right ) dx-\int _{0}^{T}f\left ( x\right ) dx \] Where in the above, (1) was used to obtain RHS. The above can now be written as\[ \int _{0}^{T}f\left ( x+a\right ) dx-\int _{0}^{T}f\left ( x\right ) dx=\overset{\int _{a}^{a+T}f\left ( x\right ) dx}{\overbrace{\left ( \int _{a}^{T}f\left ( x\right ) dx+\int _{T}^{T+a}f\left ( x\right ) dx\right ) }}-\int _{0}^{T}f\left ( x\right ) dx \] But \(\int _{T}^{T+a}f\left ( x\right ) dx=\int _{0}^{a}f\left ( x\right ) dx\) since \(f\left ( x\right ) \) is periodic with period \(T\). The above now becomes\begin{align*} \int _{0}^{T}f\left ( x+a\right ) dx-\int _{0}^{T}f\left ( x\right ) dx & =\left ( \int _{a}^{T}f\left ( x\right ) dx+\int _{0}^{a}f\left ( x\right ) dx\right ) -\int _{0}^{T}f\left ( x\right ) dx\\ & =\int _{0}^{T}f\left ( x\right ) dx-\int _{0}^{T}f\left ( x\right ) dx\\ & =0 \end{align*}
Therefore \(\int _{0}^{T}f\left ( x+a\right ) dx=\int _{0}^{T}f\left ( x\right ) dx\) which is what the problem is asking to show.
(a) Sketch the \(2\pi \) periodic half-wave \(f\left ( x\right ) =\left \{ \begin{array} [c]{ccc}\sin x & & 0<x\leq \pi \\ 0 & & -\pi \leq x<0 \end{array} \right . \). (b) Find its Fourier series. (c) Graph the first five Fourier sums and compare the function. (d) Discuss convergence of the Fourier series.
solution
The Fourier series is given by
\[ f\left ( x\right ) \sim \frac{a_{0}}{2}+\sum _{n=1}^{\infty }a_{n}\cos \left ( \frac{2\pi }{T}nx\right ) +a_{n}\sin \left ( \frac{2\pi }{T}nx\right ) \] Where \(T\) is the period of the function to be approximated. Taking this period to be \(2\pi \), the above simplifies to\[ f\left ( x\right ) \sim \frac{a_{0}}{2}+\sum _{n=1}^{\infty }a_{n}\cos \left ( nx\right ) +b_{n}\sin \left ( nx\right ) \] Hence\begin{align*} a_{0} & =\frac{1}{\pi }\int _{-\pi }^{\pi }f\left ( x\right ) dx\\ & =\frac{1}{\pi }\int _{0}^{\pi }\sin \left ( x\right ) dx\\ & =\frac{1}{\pi }\left [ -\cos \left ( x\right ) \right ] _{0}^{\pi }\\ & =\frac{-1}{\pi }\left [ \cos \left ( x\right ) \right ] _{0}^{\pi }\\ & =\frac{-1}{\pi }\left [ \cos \left ( \pi \right ) -1\right ] \\ & =\frac{-1}{\pi }\left [ -1-1\right ] \\ & =\frac{2}{\pi } \end{align*}
And\begin{align*} a_{n} & =\frac{1}{\pi }\int _{-\pi }^{\pi }f\left ( x\right ) \cos \left ( nx\right ) dx\\ & =\frac{1}{\pi }\int _{0}^{\pi }\sin \left ( x\right ) \cos \left ( nx\right ) dx \end{align*}
For \(n=1\)\begin{align*} a_{n} & =\frac{1}{\pi }\int _{0}^{\pi }\sin \left ( x\right ) \cos \left ( x\right ) dx\\ & =0 \end{align*}
And for \(n>1\)\[ a_{n}=\frac{1}{\pi }\int _{0}^{\pi }\sin \left ( x\right ) \cos \left ( nx\right ) dx \] Using \(\sin A\cos B=\frac{1}{2}\left ( \sin \left ( A-B\right ) +\sin \left ( A+b\right ) \right ) \), then \(\sin \left ( x\right ) \cos \left ( nx\right ) =\frac{1}{2}\left ( \sin \left ( x-nx\right ) +\sin \left ( x+nx\right ) \right ) \). The above becomes\begin{align*} a_{n} & =\frac{1}{2\pi }\int _{0}^{\pi }\sin \left ( x-nx\right ) +\sin \left ( x+nx\right ) dx\\ & =\frac{1}{2\pi }\left ( \int _{0}^{\pi }\sin \left ( x-nx\right ) dx+\int _{0}^{\pi }\sin \left ( x+nx\right ) dx\right ) \\ & =\frac{1}{2\pi }\left ( -\frac{1}{1-n}\left [ \cos \left ( x-nx\right ) \right ] _{0}^{\pi }-\frac{1}{1+n}\left [ \cos \left ( x+nx\right ) \right ] _{0}^{\pi }\right ) \\ & =\frac{-1}{2\pi }\left ( \frac{1}{1-n}\left [ \cos \left ( \pi -n\pi \right ) -1\right ] +\frac{1}{1+n}\left [ \cos \left ( \pi -n\pi \right ) -1\right ] \right ) \end{align*}
But \(\cos \left ( \pi -n\pi \right ) =-\cos \left ( n\pi \right ) \). The above becomes\begin{align*} a_{n} & =\frac{-1}{2\pi }\left ( \frac{1}{1-n}\left [ -\cos \left ( n\pi \right ) -1\right ] +\frac{1}{1+n}\left [ -\cos \left ( n\pi \right ) -1\right ] \right ) \\ & =\frac{1}{2\pi }\left ( \frac{\cos \left ( n\pi \right ) +1}{1-n}+\frac{\cos \left ( n\pi \right ) +1}{1+n}\right ) \\ & =\frac{1}{2\pi }\left ( \frac{\left ( 1+n\right ) \left ( \cos \left ( n\pi \right ) +1\right ) +\left ( 1-n\right ) \left ( \cos \left ( n\pi \right ) +1\right ) }{\left ( 1-n\right ) \left ( 1+n\right ) }\right ) \\ & =\frac{1}{2\pi }\left ( \frac{\left ( 1+n\right ) \left ( \cos \left ( n\pi \right ) +1\right ) +\left ( 1-n\right ) \left ( \cos \left ( n\pi \right ) +1\right ) }{\left ( 1-n^{2}\right ) }\right ) \\ & =\frac{1}{2\pi \left ( 1-n^{2}\right ) }\left ( \left ( 1+n\right ) \left ( \cos \left ( n\pi \right ) +1\right ) +\left ( 1-n\right ) \left ( \cos \left ( n\pi \right ) +1\right ) \right ) \\ & =\frac{1}{2\pi \left ( 1-n^{2}\right ) }\left ( 2\cos \left ( \pi n\right ) +2\right ) \\ & =\frac{1}{\pi \left ( 1-n^{2}\right ) }\left ( \cos \left ( \pi n\right ) +1\right ) \\ & =\frac{1+\left ( -1\right ) ^{n}}{\pi \left ( 1-n^{2}\right ) } \end{align*}
For odd \(n=3,5,\cdots \) then \(a_{n}=0\). For even \(n\) the above can be written as\[ a_{n}=\frac{2}{\pi \left ( 1-n^{2}\right ) }\qquad n=2,4,6,\cdots \] Now \(b_{n}\) is found\begin{align*} b_{n} & =\frac{1}{\pi }\int _{-\pi }^{\pi }f\left ( x\right ) \sin \left ( nx\right ) dx\\ & =\frac{1}{\pi }\int _{0}^{\pi }\sin \left ( x\right ) \sin \left ( nx\right ) dx \end{align*}
Consider case \(n=1\) first. The above gives\begin{align*} b_{1} & =\frac{1}{\pi }\int _{0}^{\pi }\sin ^{2}\left ( x\right ) dx\\ & =\frac{1}{\pi }\int _{0}^{\pi }\frac{1}{2}-\frac{1}{2}\cos \left ( 2x\right ) dx\\ & =\frac{1}{\pi }\left ( \int _{0}^{\pi }\frac{1}{2}dx-\frac{1}{2}\int _{0}^{\pi }\cos \left ( 2x\right ) dx\right ) \\ & =\frac{1}{\pi }\left ( \frac{1}{2}\pi -\frac{1}{2}\left [ \frac{\sin \left ( 2x\right ) }{2}\right ] _{0}^{\pi }\right ) \\ & =\frac{1}{2} \end{align*}
For \(n>1\)\begin{align*} b_{n} & =\frac{1}{\pi }\int _{0}^{\pi }\sin x\sin \left ( nx\right ) dx\\ & =\frac{1}{\pi }\frac{\sin \left ( n\pi \right ) }{n^{2}-1}\\ & =0 \end{align*}
Therefore the Fourier series is \begin{align*} f\left ( x\right ) & \sim \frac{a_{0}}{2}+\sum _{n=1}^{\infty }a_{n}\cos \left ( nx\right ) +b_{n}\sin \left ( nx\right ) \\ & =\frac{1}{\pi }+\frac{1}{2}\sin \left ( x\right ) +\frac{2}{\pi }\sum _{n=2,4,6,\cdots }^{\infty }\frac{1}{1-n^{2}}\cos \left ( nx\right ) \\ & =\frac{1}{\pi }+\frac{1}{2}\sin \left ( x\right ) +\frac{2}{\pi }\sum _{n=1}^{\infty }\frac{1}{1-\left ( 2n\right ) ^{2}}\cos \left ( 2nx\right ) \end{align*}
The function \(f\left ( x\right ) \) is piecewise \(C^{1}\) continuous over \(-\pi \leq x\leq \pi \). Therefore the \(2\pi \) periodic extension is also piecewise \(C^{1}\) continuous over all \(x\). There are no jump discontinues (only corner points). The Fourier series converges to \(f\left ( x\right ) \) at each \(x\in \Re \). (If there was a jump discontinuity at some \(x\), then the Fourier series will converge to the average of \(f\left ( x\right ) \) at that \(x\), but this is not the case here).
(a) Find the Fourier series of \(f\left ( x\right ) =e^{x}\). (b) For which values of \(x\) does the Fourier series converges? Is the convergence uniform? (c) Graph the function it converges to.
solution
For generality, the Fourier series for \(e^{ax}\) is found, then at the end \(a\) is set to be one. It is assumed the period is \(2\pi \).
\[ e^{ax}\sim \frac{a_{0}}{2}+\sum _{n=1}^{\infty }a_{n}\cos \left ( \frac{2\pi }{T}nx\right ) +b_{n}\sin \left ( \frac{2\pi }{T}nx\right ) \] But \(T=2\pi \) and the above becomes\[ e^{ax}\sim \frac{a_{0}}{2}+\sum _{n=1}^{\infty }a_{n}\cos \left ( nx\right ) +b_{n}\sin \left ( nx\right ) \] Where\begin{align*} a_{0} & =\frac{1}{\frac{T}{2}}\int _{-\frac{T}{2}}^{\frac{T}{2}}f\left ( x\right ) dx\\ & =\frac{1}{\pi }\int _{-\pi }^{\pi }e^{ax}dx\\ & =\frac{1}{\pi }\left [ \frac{e^{ax}}{a}\right ] _{-\pi }^{\pi }\\ & =\frac{1}{\pi a}\left ( e^{a\pi }-e^{-a\pi }\right ) \end{align*}
But \(\frac{e^{a\pi }-e^{-a\pi }}{2}=\sinh \left ( a\pi \right ) \) hence the above simplifies to\[ a_{0}=\frac{2}{\pi a}\sinh \left ( a\pi \right ) \] And for \(n>0\)\begin{align} a_{n} & =\frac{1}{\frac{T}{2}}\int _{-\frac{T}{2}}^{\frac{T}{2}}f\left ( x\right ) \cos \left ( \frac{2\pi }{T}nx\right ) dx\nonumber \\ & =\frac{1}{\pi }\int _{-\pi }^{\pi }e^{ax}\cos \left ( nx\right ) dx \tag{1} \end{align}
Let \(I=\int _{-\pi }^{\pi }e^{ax}\cos \left ( nx\right ) dx\). Using integration by parts, \(\int udv=uv-\int vdu\). Let \(u=\cos nx,dv=e^{ax}\) then \(v=\frac{e^{ax}}{a},du=-n\sin \left ( nx\right ) \). Hence\begin{align*} I & =uv-\int vdu\\ & =\left [ \cos \left ( nx\right ) \frac{e^{ax}}{a}\right ] _{-\pi }^{\pi }+\frac{n}{a}\int _{-\pi }^{\pi }e^{ax}\sin \left ( nx\right ) dx\\ & =\left [ \cos \left ( n\pi \right ) \frac{e^{a\pi }}{a}-\cos \left ( n\pi \right ) \frac{e^{-a\pi }}{a}\right ] +\frac{n}{a}\int _{-\pi }^{\pi }e^{ax}\sin \left ( nx\right ) dx\\ & =\left ( -1\right ) ^{n}\left [ \frac{e^{a\pi }-e^{-a\pi }}{a}\right ] +\frac{n}{a}\int _{-\pi }^{\pi }e^{ax}\sin \left ( nx\right ) dx\\ & =\frac{2\left ( -1\right ) ^{n}}{a}\left [ \frac{e^{a\pi }-e^{-a\pi }}{2}\right ] +\frac{n}{a}\int _{-\pi }^{\pi }e^{ax}\sin \left ( nx\right ) dx\\ & =\frac{2\left ( -1\right ) ^{n}}{a}\sinh \left ( a\pi \right ) +\frac{n}{a}\int _{-\pi }^{\pi }e^{ax}\sin \left ( nx\right ) dx \end{align*}
Applying integration by parts again on the integral above. Let \(u=\sin nx,dv=e^{ax}\) then \(v=\frac{e^{ax}}{a},du=n\cos \left ( nx\right ) \) and the above becomes\begin{align*} I & =\frac{2\left ( -1\right ) ^{n}}{a}\sinh \left ( a\pi \right ) +\frac{n}{a}\left ( \left ( \sin nx\frac{e^{ax}}{a}\right ) _{-\pi }^{\pi }-\frac{n}{a}\int _{-\pi }^{\pi }e^{ax}\cos \left ( nx\right ) dx\right ) \\ & =\frac{2\left ( -1\right ) ^{n}}{a}\sinh \left ( a\pi \right ) +\frac{n}{a}\left ( \frac{1}{a}\overset{0}{\overbrace{\left ( \sin \left ( n\pi \right ) e^{a\pi }+\sin \left ( n\pi \right ) e^{-a\pi }\right ) }}-\frac{n}{a}\int _{-\pi }^{\pi }e^{ax}\cos \left ( nx\right ) dx\right ) \\ & =\frac{2\left ( -1\right ) ^{n}}{a}\sinh \left ( a\pi \right ) -\frac{n^{2}}{a^{2}}\int _{-\pi }^{\pi }e^{ax}\cos \left ( nx\right ) dx \end{align*}
But \(\int _{-\pi }^{\pi }e^{ax}\cos \left ( nx\right ) dx=I\), the original integral we are solving for. Hence solving for \(I\) from the above gives gives\begin{align} I & =\frac{2\left ( -1\right ) ^{n}}{a}\sinh \left ( a\pi \right ) -\frac{n^{2}}{a^{2}}I\nonumber \\ I+\frac{n^{2}}{a^{2}}I & =\frac{2\left ( -1\right ) ^{n}}{a}\sinh \left ( a\pi \right ) \nonumber \\ I\left ( 1+\frac{n^{2}}{a^{2}}\right ) & =\frac{2\left ( -1\right ) ^{n}}{a}\sinh \left ( a\pi \right ) \nonumber \\ I & =\frac{\frac{2\left ( -1\right ) ^{n}}{a}\sinh \left ( a\pi \right ) }{1+\frac{n^{2}}{a^{2}}}\nonumber \\ & =\frac{2a\left ( -1\right ) ^{n}\sinh \left ( a\pi \right ) }{a^{2}+n^{2}} \tag{2} \end{align}
Using (2) in (1) gives\begin{align} a_{n} & =\frac{1}{\pi }\int _{-\pi }^{\pi }e^{ax}\cos \left ( nx\right ) dx\nonumber \\ & =\frac{a}{\pi }\frac{2\left ( -1\right ) ^{n}\sinh \left ( a\pi \right ) }{a^{2}+n^{2}} \tag{3} \end{align}
Now we will do the same to find \(b_{n}\)\begin{align} b_{n} & =\frac{1}{\frac{T}{2}}\int _{-\frac{T}{2}}^{\frac{T}{2}}f\left ( x\right ) \sin \left ( \frac{2\pi }{T}nx\right ) dx\nonumber \\ & =\frac{1}{\pi }\int _{-\pi }^{\pi }e^{ax}\sin \left ( nx\right ) dx \tag{4} \end{align}
Let \(I=\int _{-\pi }^{\pi }e^{ax}\sin \left ( nx\right ) dx\). Using integration by parts, \(\int udv=uv-\int vdu\). Let \(u=\sin \left ( nx\right ) ,dv=e^{ax}\) then \(v=\frac{e^{ax}}{a},du=n\cos \left ( nx\right ) \). Hence\begin{align*} I & =uv-\int vdu\\ & =\left [ \sin \left ( nx\right ) \frac{e^{ax}}{a}\right ] _{-\pi }^{\pi }-\frac{n}{a}\int _{-\pi }^{\pi }e^{ax}\cos \left ( nx\right ) dx\\ & =\overset{0}{\overbrace{\left [ \sin \left ( n\pi \right ) \frac{e^{a\pi }}{a}-\sin \left ( n\pi \right ) \frac{e^{-a\pi }}{a}\right ] }}-\frac{n}{a}\int _{-\pi }^{\pi }e^{ax}\cos \left ( nx\right ) dx\\ & =-\frac{n}{a}\int _{-\pi }^{\pi }e^{ax}\cos \left ( nx\right ) dx \end{align*}
Now we apply integration by parts again on the integral above. Let \(u=\cos nx,dv=e^{ax}\) then \(v=\frac{e^{ax}}{a},du=-n\sin \left ( nx\right ) \) and the above becomes\begin{align*} I & =-\frac{n}{a}\left ( \left ( \cos \left ( nx\right ) \frac{e^{ax}}{a}\right ) _{-\pi }^{\pi }+\frac{n}{a}\int _{-\pi }^{\pi }e^{ax}\sin \left ( nx\right ) dx\right ) \\ & =-\frac{n}{a}\left ( \frac{1}{a}\left ( \cos \left ( n\pi \right ) e^{a\pi }-\cos \left ( n\pi \right ) e^{-a\pi }\right ) +\frac{n}{a}\int _{-\pi }^{\pi }e^{ax}\sin \left ( nx\right ) dx\right ) \\ & =-\frac{n}{a}\left ( \frac{1}{a}\cos \left ( n\pi \right ) \left ( e^{a\pi }-e^{-a\pi }\right ) +\frac{n}{a}\int _{-\pi }^{\pi }e^{ax}\sin \left ( nx\right ) dx\right ) \\ & =-\frac{n}{a}\left ( \frac{2}{a}\cos \left ( n\pi \right ) \left ( \frac{e^{a\pi }-e^{-a\pi }}{2}\right ) +\frac{n}{a}\int _{-\pi }^{\pi }e^{ax}\sin \left ( nx\right ) dx\right ) \\ & =-\frac{n}{a}\left ( \frac{2}{a}\cos \left ( n\pi \right ) \sinh \left ( a\pi \right ) +\frac{n}{a}\int _{-\pi }^{\pi }e^{ax}\sin \left ( nx\right ) dx\right ) \\ & =-\frac{2n}{a^{2}}\left ( -1\right ) ^{n}\sinh \left ( a\pi \right ) -\frac{n^{2}}{a^{2}}\int _{-\pi }^{\pi }e^{ax}\sin \left ( nx\right ) dx \end{align*}
But \(\int _{-\pi }^{\pi }e^{ax}\sin \left ( nx\right ) dx=I\). Hence solving for \(I\) gives\begin{align} I & =-\frac{2n}{a^{2}}\left ( -1\right ) ^{n}\sinh \left ( a\pi \right ) -\frac{n^{2}}{a^{2}}I\nonumber \\ I+\frac{n^{2}}{a^{2}}I & =-\frac{2n}{a^{2}}\left ( -1\right ) ^{n}\sinh \left ( a\pi \right ) \nonumber \\ I\left ( 1+\frac{n^{2}}{a^{2}}\right ) & =-\frac{2n}{a^{2}}\left ( -1\right ) ^{n}\sinh \left ( a\pi \right ) \nonumber \\ I & =-\frac{\frac{2n}{a^{2}}\left ( -1\right ) ^{n}\sinh \left ( a\pi \right ) }{1+\frac{n^{2}}{a^{2}}}\nonumber \\ I & =-\frac{2n\left ( -1\right ) ^{n}}{a^{2}+n^{2}}\sinh \left ( a\pi \right ) \tag{5} \end{align}
Using (5) in (4) gives\begin{align*} b_{n} & =\frac{1}{\pi }\int _{-\pi }^{\pi }e^{ax}\sin \left ( nx\right ) dx\\ & =-\frac{1}{\pi }\frac{2n\left ( -1\right ) ^{n}}{a^{2}+n^{2}}\sinh \left ( a\pi \right ) \end{align*}
Now that we found \(a_{0},a_{n},b_{n}\) then the Fourier series is\begin{align*} e^{ax} & \sim \frac{a_{0}}{2}+\sum _{n=1}^{\infty }a_{n}\cos \left ( nx\right ) +b_{n}\sin \left ( nx\right ) \\ & \sim \frac{\frac{2}{\pi a}\sinh \left ( a\pi \right ) }{2}+\sum _{n=1}^{\infty }\frac{a}{\pi }\frac{2\left ( -1\right ) ^{n}\sinh \left ( a\pi \right ) }{a^{2}+n^{2}}\cos \left ( nx\right ) -\frac{1}{\pi }\frac{2n\left ( -1\right ) ^{n}}{a^{2}+n^{2}}\sinh \left ( a\pi \right ) \sin \left ( nx\right ) \\ & \sim \frac{\sinh \left ( a\pi \right ) }{\pi a}+\frac{1}{\pi }\sinh \left ( a\pi \right ) \sum _{n=1}^{\infty }\frac{2\left ( -1\right ) ^{n}}{a^{2}+n^{2}}\left ( a\cos \left ( nx\right ) -n\sin \left ( nx\right ) \right ) \\ & \sim \sinh \left ( a\pi \right ) \left ( \frac{1}{\pi a}+\frac{1}{\pi }\sum _{n=1}^{\infty }\frac{2\left ( -1\right ) ^{n}}{a^{2}+n^{2}}\left ( a\cos \left ( nx\right ) -n\sin \left ( nx\right ) \right ) \right ) \\ & \sim \frac{2\sinh \left ( a\pi \right ) }{\pi }\left ( \frac{1}{2a}+\sum _{n=1}^{\infty }\frac{\left ( -1\right ) ^{n}}{a^{2}+n^{2}}\left ( a\cos \left ( nx\right ) -n\sin \left ( nx\right ) \right ) \right ) \end{align*}
When \(a=1\) the above becomes\[ e^{x}\sim \frac{2\sinh \left ( \pi \right ) }{\pi }\left ( \frac{1}{2}+\sum _{n=1}^{\infty }\frac{\left ( -1\right ) ^{n}}{1+n^{2}}\left ( \cos \left ( nx\right ) -n\sin \left ( nx\right ) \right ) \right ) \]
The \(2\pi \) periodic extended function shows it piecewise \(C^{1}\) over all points except at the points \(x=\cdots ,-5\pi ,-3\pi ,\pi ,3\pi ,5\pi ,\cdots \). These are points at the ends of the original domain. At these points, there is a jump discontinuity. Therefore the Fourier series at these points will converge to the average of the \(2\pi \) periodic extended \(e^{x}\). Due to the jump discontinuity Gibbs phenomena shows up at these points. This also means that the convergence is not uniform.
The following is a plot showing the convergence using different number of terms in the above sum. This shows the Fourier series converges to \(e^{x}\) at all points inside the interval, except at the end points \(x=-\pi ,\pi \) where it converges to the average of \(f\left ( x\right ) \).
Suppose \(a_{k},b_{k}\) are the Fourier coefficients of the function \(f\left ( x\right ) \). (a) To which function does the Fourier series \[ \frac{a_{0}}{2}+\sum _{k=1}^{\infty }a_{k}\cos \left ( 2kx\right ) +b_{k}\sin \left ( 2kx\right ) \] Converge? (b) Test your answer with the Fourier series (3.37) for \(f\left ( x\right ) =x\).\begin{equation} x\sim 2\left ( \sin x-\frac{\sin 2x}{2}+\frac{\sin 3x}{3}-\frac{\sin 4x}{4}+\cdots \right ) \tag{3.37} \end{equation}
solution
Let \begin{align*} g\left ( x\right ) & \sim \frac{a_{0}}{2}+\sum _{k=1}^{\infty }a_{k}\cos \left ( 2kx\right ) +b_{k}\sin \left ( 2kx\right ) \\ f\left ( x\right ) & \sim \frac{a_{0}}{2}+\sum _{k=1}^{\infty }a_{k}\cos \left ( kx\right ) +b_{k}\sin \left ( kx\right ) \end{align*}
Then \(g\left ( x\right ) \) has as its period half the period of \(f\left ( x\right ) \). This is because when \(2kx=\frac{2\pi }{T}kx\) then \(T=\pi \) and when \(kx=\frac{2\pi }{T}kx\) then \(T=2\pi \).
Therefore, if \(f\left ( x\right ) \) has fundamental period as \(-\pi <x<\pi \), then \(g\left ( x\right ) \) has a fundamental period as \(-\frac{\pi }{2}<x<\frac{\pi }{2}\). And since \(f\left ( x\right ) ,g\left ( x\right ) \) have the same Fourier series coefficients, then \(g\left ( x\right ) \) converges to \(2f\left ( x\right ) \) but only over \(-\frac{\pi }{2}<x<\frac{\pi }{2}\).
Let \(f\left ( x\right ) =x\) whose we are given that its Fourier series is\begin{align*} f\left ( x\right ) & \sim 2\left ( \sin x-\frac{\sin 2x}{2}+\frac{\sin 3x}{3}-\frac{\sin 4x}{4}+\cdots \right ) \\ & =2\sin x-\sin 2x+\frac{2}{3}\sin 3x-\frac{1}{2}\sin 4x+\cdots \end{align*}
The above says that \(a_{k}=0\) and \(b_{k}=\frac{2\left ( -1\right ) ^{k+1}}{k}\). Hence\[ f\left ( x\right ) \sim \sum _{k=1}^{\infty }\frac{2\left ( -1\right ) ^{k+1}}{k}\sin \left ( kx\right ) \] Therefore \(g\left ( x\right ) \) will converge to \begin{align*} g\left ( x\right ) & \sim \frac{a_{0}}{2}+\sum _{k=1}^{\infty }a_{k}\cos \left ( 2kx\right ) +b_{k}\sin \left ( 2kx\right ) \\ & =\sum _{k=1}^{\infty }\frac{2\left ( -1\right ) ^{k+1}}{k}\sin \left ( 2kx\right ) \\ & =2\left ( +1\right ) \sin \left ( 2x\right ) +\frac{-2}{2}\sin \left ( 4x\right ) +\frac{2\left ( +1\right ) }{3}\sin \left ( 6x\right ) +\frac{-2}{4}\sin \left ( 8x\right ) +\cdots \\ & =2\sin \left ( 2x\right ) -\sin \left ( 4x\right ) +\frac{2}{3}\sin \left ( 6x\right ) -\frac{1}{2}\sin \left ( 8x\right ) +\cdots \end{align*}
Over \(-\frac{\pi }{2}<x<\frac{\pi }{2}\). To verify the above, we will now find \(a_{k},b_{k}\) directly for \(x\) but using \(T=\pi \) and not \(T=2\pi \) to see if the above Fourier series is obtained.\begin{align*} a_{0} & =\frac{2}{\pi }\int _{-\frac{\pi }{2}}^{\frac{\pi }{2}}xdx\\ & =0 \end{align*}
And\[ a_{k}=\frac{2}{\pi }\int _{-\frac{\pi }{2}}^{\frac{\pi }{2}}x\cos \left ( 2kx\right ) dx \] Since \(x\) is odd function and \(\cos \) is even, the product is odd. Hence \(a_{k}=0\). \begin{align*} b_{k} & =\frac{2}{\pi }\int _{-\frac{\pi }{2}}^{\frac{\pi }{2}}x\sin \left ( 2kx\right ) dx\\ & =\frac{4}{\pi }\int _{0}^{\frac{\pi }{2}}x\sin \left ( 2kx\right ) dx\\ & =\frac{4}{\pi }\left ( \frac{-k\pi \cos \left ( k\pi \right ) +\sin \left ( k\pi \right ) }{4k^{2}}\right ) \\ & =\frac{1}{\pi k^{2}}\left ( -k\pi \cos \left ( k\pi \right ) \right ) \\ & =\frac{-1}{k}\cos \left ( k\pi \right ) \\ & =\frac{-1}{k}\left ( -1\right ) ^{k}\\ & =\frac{\left ( -1\right ) ^{k+1}}{k} \end{align*}
Therefore \begin{align*} g\left ( x\right ) & \sim \frac{a_{0}}{2}+\sum _{k=1}^{\infty }a_{k}\cos \left ( 2kx\right ) +b_{k}\sin \left ( 2kx\right ) \\ & =\sum _{k=1}^{\infty }\frac{\left ( -1\right ) ^{k}}{k}\sin \left ( 2kx\right ) \end{align*}