3.5 HW 5

  3.5.1 Problem 1
  3.5.2 Problem 2
  3.5.3 Problem 3
  3.5.4 key solution to HW 5
PDF (letter size)
PDF (legal size)

3.5.1 Problem 1

Expand the following functions, which are periodic in \(\frac{2\pi }{L}\), in Fourier series (i) \(f\left ( x\right ) =1-\frac{\left \vert x\right \vert }{L}\) for \(\frac{-L}{2}\leq x\leq \frac{L}{2}\). (ii) \(f\left ( x\right ) =e^{x}\) for \(\frac{-L}{2}\leq x\leq \frac{L}{2}\)

Solution

Part 1

The following is a plot of the function \(f\left ( x\right ) =1-\frac{\left \vert x\right \vert }{L}\). In the plot below \(L=1\) was used for illustration.

pict
Figure 3.10:Function plot
pict
Figure 3.11:Code used

The Fourier series of \(f\left ( x\right ) =\) is given by\begin{equation} f\left ( x\right ) =\frac{a_{0}}{2}+\sum _{n=1}^{\infty }a_{n}\cos \left ( \frac{2\pi }{L}nx\right ) +b_{n}\sin \left ( \frac{2\pi }{L}nx\right ) \tag{1} \end{equation} Where \(L\) is the period. \[ a_{0}=\frac{2}{L}\int _{-\frac{L}{2}}^{\frac{L}{2}}f\left ( x\right ) dx \] \(\int _{-\frac{L}{2}}^{\frac{L}{2}}f\left ( x\right ) dx\) is the area under the curve. Looking at the plot above shows the area is made up of the lower rectangle of area \(\frac{1}{2}L\) and a triangle whose area is \(\left ( \frac{1}{2}L\right ) \left ( \frac{1}{2}\right ) \). Therefore the total area is \(\frac{1}{2}L+\frac{1}{4}L=\frac{3}{4}L\). Hence\begin{align*} a_{0} & =\frac{2}{L}\left ( \frac{3}{4}L\right ) \\ & =\frac{3}{2} \end{align*}

And \[ a_{n}=\frac{2}{L}\int _{-\frac{L}{2}}^{\frac{L}{2}}f\left ( x\right ) \cos \left ( \frac{2\pi }{L}nx\right ) dx \] Since \(f\left ( x\right ) \) is an even function, the above simplifies to\begin{align*} a_{n} & =\frac{4}{L}\int _{0}^{\frac{L}{2}}f\left ( x\right ) \cos \left ( \frac{2\pi }{L}nx\right ) dx\\ & =\frac{4}{L}\int _{0}^{\frac{L}{2}}\left ( 1-\frac{x}{L}\right ) \cos \left ( \frac{2\pi }{L}nx\right ) dx\\ & =\frac{4}{L}\left ( \int _{0}^{\frac{L}{2}}\cos \left ( \frac{2\pi }{L}nx\right ) dx-\frac{1}{L}\int _{0}^{\frac{L}{2}}x\cos \left ( \frac{2\pi }{L}nx\right ) dx\right ) \\ & =\frac{4}{L}\left ( \left [ \sin \left ( \frac{2\pi }{L}nx\right ) \right ] _{0}^{\frac{L}{2}}-\frac{1}{L}\int _{0}^{\frac{L}{2}}x\cos \left ( \frac{2\pi }{L}nx\right ) dx\right ) \\ & =\frac{4}{L}\left ( \left [ \sin \left ( \frac{2\pi }{L}n\left ( \frac{L}{2}\right ) -0\right ) \right ] -\frac{1}{L}\int _{0}^{\frac{L}{2}}x\cos \left ( \frac{2\pi }{L}nx\right ) dx\right ) \\ & =\frac{4}{L}\left ( \overset{0}{\overbrace{\left [ \sin \pi n\right ] }}-\frac{1}{L}\int _{0}^{\frac{L}{2}}x\cos \left ( \frac{2\pi }{L}nx\right ) dx\right ) \\ & =-\frac{4}{L^{2}}\int _{0}^{\frac{L}{2}}x\cos \left ( \frac{2\pi }{L}nx\right ) dx \end{align*}

Using integration by parts: Let \(u=x,dv=\cos \left ( \frac{2\pi }{L}nx\right ) \) then \(du=1,v=\frac{\sin \left ( \frac{2\pi }{L}nx\right ) }{\frac{2\pi }{L}n}=\frac{L}{2\pi n}\sin \left ( \frac{2\pi }{L}nx\right ) \). The above integral becomes\begin{align*} \int _{0}^{\frac{L}{2}}x\cos \left ( \frac{2\pi }{L}nx\right ) dx & =\left ( \frac{L}{2\pi n}x\sin \left ( \frac{2\pi }{L}nx\right ) \right ) _{0}^{\frac{L}{2}}-\frac{L}{2\pi n}\int _{0}^{\frac{L}{2}}\sin \left ( \frac{2\pi }{L}nx\right ) dx\\ & =\left ( \frac{L}{2\pi n}\left ( \frac{L}{2}\right ) \sin \left ( \frac{2\pi }{L}n\frac{L}{2}\right ) -0\right ) -\frac{L}{2\pi n}\left ( -\frac{\cos \left ( \frac{2\pi }{L}nx\right ) }{\frac{2\pi }{L}n}\right ) _{0}^{\frac{L}{2}}\\ & =\frac{L^{2}}{4\pi n}\sin \left ( n\pi \right ) +\frac{L^{2}}{4\pi ^{2}n^{2}}\left ( \cos \left ( \frac{2\pi }{L}n\left ( \frac{L}{2}\right ) \right ) -1\right ) \\ & =\frac{L^{2}}{4\pi ^{2}n^{2}}\left ( \cos \left ( \pi n\right ) -1\right ) \end{align*}

Therefore\begin{align*} a_{n} & =-\frac{4}{L^{2}}\left ( \frac{L^{2}}{4\pi ^{2}n^{2}}\left ( \cos \left ( \pi n\right ) -1\right ) \right ) \\ & =\frac{1}{\pi ^{2}n^{2}}\left ( 1-\cos \left ( \pi n\right ) \right ) \end{align*}

The above is zero for even \(n\) and \(\frac{2L^{2}}{4\pi ^{2}n^{2}}\) for odd \(n\). Therefore the above simplifies to\[ a_{n}=\frac{2}{\pi ^{2}n^{2}}\qquad n=1,3,5,\cdots \] Because \(f\left ( x\right ) \) is an even function, then \(b_{n}=0\) for all \(n\). The Fourier series from (1) now becomes\[ f\left ( x\right ) =\frac{3}{4}+\sum _{n=1,3,5,\cdots }^{\infty }\frac{2}{\pi ^{2}n^{2}}\cos \left ( \frac{2\pi }{L}nx\right ) \] To verify the above result, the Fourier series approximation given above was plotted for increasing \(n\) against the original \(f\left ( x\right ) \) function in order to see how the approximation improves as \(n\) increases. Using \(L=2\), the result is given below.

The original function is in the red color. The plot shows that the convergence is fast (due to the \(\frac{1}{n^{2}}\) term). The convergence is uniform. After only 4 terms, the error between \(f\left ( x\right ) \) and its Fourier series approximation becomes very small. As expected, the error is largest at the top and at the lower corners where the original function changes more rapidly and therefore more terms would be needed in those regions compared to the straight edges regions of the function \(f\left ( x\right ) \) to get a better approximation.

pict
Figure 3.12:Fourier series approximation, part 1
pict
Figure 3.13:Code used
Part 2

The following is a plot of the function \(f\left ( x\right ) =e^{x}\). In this plot, \(L=1\) was used.

pict
Figure 3.14:Function plot part 2
pict
Figure 3.15:Code used

The Fourier series of \(f\left ( x\right ) =\) is given by\begin{equation} f\left ( x\right ) =\frac{a_{0}}{2}+\sum _{n=1}^{\infty }a_{n}\cos \left ( \frac{2\pi }{L}nx\right ) +b_{n}\sin \left ( \frac{2\pi }{L}nx\right ) \tag{1A} \end{equation} Where \(L\) is the period and\begin{align*} a_{0} & =\frac{2}{L}\int _{-\frac{L}{2}}^{\frac{L}{2}}f\left ( x\right ) dx\\ & =\frac{2}{L}\int _{-\frac{L}{2}}^{\frac{L}{2}}e^{x}dx\\ & =\frac{2}{L}\left [ e^{x}\right ] _{-\frac{L}{2}}^{\frac{L}{2}}\\ & =\frac{2}{L}\left [ e^{\frac{L}{2}}-e^{-\frac{L}{2}}\right ] \\ & =\frac{4}{L}\left [ \frac{e^{\frac{L}{2}}-e^{-\frac{L}{2}}}{2}\right ] \\ & =\frac{4}{L}\sinh \left ( \frac{L}{2}\right ) \end{align*}

And \begin{align} a_{n} & =\frac{2}{L}\int _{-\frac{L}{2}}^{\frac{L}{2}}f\left ( x\right ) \cos \left ( \frac{2\pi }{L}nx\right ) dx\nonumber \\ & =\frac{2}{L}\int _{-\frac{L}{2}}^{\frac{L}{2}}e^{x}\cos \left ( \frac{2\pi }{L}nx\right ) dx \tag{1} \end{align}

Integration by parts: Let \(u=\cos \left ( \frac{2\pi }{L}nx\right ) ,du=-\frac{2\pi n}{L}\sin \left ( \frac{2\pi }{L}nx\right ) \) and let \(dv=e^{x},v=e^{x}\), therefore\begin{align*} I & =\int _{-\frac{L}{2}}^{\frac{L}{2}}e^{x}\cos \left ( \frac{2\pi }{L}nx\right ) dx\\ & =\left [ e^{x}\cos \left ( \frac{2\pi }{L}nx\right ) \right ] _{-\frac{L}{2}}^{\frac{L}{2}}-\int _{-\frac{L}{2}}^{\frac{L}{2}}-\frac{2\pi n}{L}\sin \left ( \frac{2\pi }{L}nx\right ) e^{x}dx\\ & =\left [ e^{\frac{L}{2}}\cos \left ( \frac{2\pi }{L}n\frac{L}{2}\right ) -e^{-\frac{L}{2}}\cos \left ( \frac{2\pi }{L}n\left ( -\frac{L}{2}\right ) \right ) \right ] +\frac{2\pi n}{L}\int _{-\frac{L}{2}}^{\frac{L}{2}}\sin \left ( \frac{2\pi }{L}nx\right ) e^{x}dx\\ & =\left [ e^{\frac{L}{2}}\cos \left ( \pi n\right ) -e^{-\frac{L}{2}}\cos \left ( \pi n\right ) \right ] +\frac{2\pi n}{L}\int _{-\frac{L}{2}}^{\frac{L}{2}}\sin \left ( \frac{2\pi }{L}nx\right ) e^{x}dx\\ & =\cos \left ( \pi n\right ) \left ( e^{\frac{L}{2}}-e^{-\frac{L}{2}}\right ) +\frac{2\pi n}{L}\int _{-\frac{L}{2}}^{\frac{L}{2}}\sin \left ( \frac{2\pi }{L}nx\right ) e^{x}dx\\ & =2\cos \left ( \pi n\right ) \sinh \left ( \frac{L}{2}\right ) +\frac{2\pi n}{L}\int _{-\frac{L}{2}}^{\frac{L}{2}}\sin \left ( \frac{2\pi }{L}nx\right ) e^{x}dx \end{align*}

Integration by parts again, let \(u=\sin \left ( \frac{2\pi }{L}nx\right ) ,du=\frac{2\pi n}{L}\cos \left ( \frac{2\pi }{L}nx\right ) \) and \(dv=e^{x},v=e^{x}\). The above becomes\[ I=2\cos \left ( \pi n\right ) \sinh \left ( \frac{L}{2}\right ) +\frac{2\pi n}{L}\left ( \left [ e^{x}\sin \left ( \frac{2\pi }{L}nx\right ) \right ] _{-\frac{L}{2}}^{\frac{L}{2}}-\int _{-\frac{L}{2}}^{\frac{L}{2}}\frac{2\pi n}{L}\cos \left ( \frac{2\pi }{L}nx\right ) e^{x}dx\right ) \] The term \(\left [ e^{x}\sin \left ( \frac{2\pi }{L}nx\right ) \right ] _{-\frac{L}{2}}^{\frac{L}{2}}\) goes to zero since it gives \(\sin \left ( n\pi \right ) \) and \(n\) is integer. The above simplifies to\begin{align*} I & =2\cos \left ( \pi n\right ) \sinh \left ( \frac{L}{2}\right ) +\frac{2\pi n}{L}\left ( -\frac{2\pi n}{L}\int _{-\frac{L}{2}}^{\frac{L}{2}}\cos \left ( \frac{2\pi }{L}nx\right ) e^{x}dx\right ) \\ & =2\cos \left ( \pi n\right ) \sinh \left ( \frac{L}{2}\right ) -\frac{4\pi ^{2}n^{2}}{L^{2}}\int _{-\frac{L}{2}}^{\frac{L}{2}}\cos \left ( \frac{2\pi }{L}nx\right ) e^{x}dx \end{align*}

Since \(\int _{-\frac{L}{2}}^{\frac{L}{2}}\cos \left ( \frac{2\pi }{L}nx\right ) e^{x}dx=I\) the above reduces to\begin{align*} I & =2\cos \left ( \pi n\right ) \sinh \left ( \frac{L}{2}\right ) -\frac{4\pi ^{2}n^{2}}{L^{2}}I\\ I\left ( 1+\frac{4\pi ^{2}n^{2}}{L^{2}}\right ) & =2\cos \left ( \pi n\right ) \sinh \left ( \frac{L}{2}\right ) \\ I & =\frac{2\cos \left ( \pi n\right ) \sinh \left ( \frac{L}{2}\right ) }{1+\frac{4\pi ^{2}n^{2}}{L^{2}}} \end{align*}

Using the above in (1) gives\begin{align*} a_{n} & =\frac{2}{L}\frac{2\cos \left ( \pi n\right ) \sinh \left ( \frac{L}{2}\right ) }{1+\frac{4\pi ^{2}n^{2}}{L^{2}}}\\ & =\frac{2L^{2}}{L}\frac{2\cos \left ( \pi n\right ) \sinh \left ( \frac{L}{2}\right ) }{L^{2}+4\pi ^{2}n^{2}}\\ & =\frac{4L}{L^{2}+4\pi ^{2}n^{2}}\cos \left ( \pi n\right ) \sinh \left ( \frac{L}{2}\right ) \end{align*}

Next, \(b_{n}\,\) is found:\begin{align} b_{n} & =\frac{2}{L}\int _{-\frac{L}{2}}^{\frac{L}{2}}f\left ( x\right ) \sin \left ( \frac{2\pi }{L}nx\right ) dx\nonumber \\ & =\frac{2}{L}\int _{-\frac{L}{2}}^{\frac{L}{2}}e^{x}\sin \left ( \frac{2\pi }{L}nx\right ) dx \tag{2} \end{align}

Integration by parts: Let \(u=\sin \left ( \frac{2\pi }{L}nx\right ) ,du=\frac{2\pi n}{L}\sin \left ( \frac{2\pi }{L}nx\right ) \) and let \(dv=e^{x},v=e^{x}\), therefore\begin{align*} I & =\int _{-\frac{L}{2}}^{\frac{L}{2}}e^{x}\sin \left ( \frac{2\pi }{L}nx\right ) dx\\ & =\left [ e^{x}\sin \left ( \frac{2\pi }{L}nx\right ) \right ] _{-\frac{L}{2}}^{\frac{L}{2}}-\int _{-\frac{L}{2}}^{\frac{L}{2}}\frac{2\pi n}{L}\cos \left ( \frac{2\pi }{L}nx\right ) e^{x}dx \end{align*}

But \(\left [ e^{x}\sin \left ( \frac{2\pi }{L}nx\right ) \right ] _{-\frac{L}{2}}^{\frac{L}{2}}\) goes to zero as \(\sin \left ( \pi n\right ) =0\) for integer \(n\) and the above simplifies to\[ I=-\frac{2\pi n}{L}\int _{-\frac{L}{2}}^{\frac{L}{2}}\cos \left ( \frac{2\pi }{L}nx\right ) e^{x}dx \] Integration by parts again: let \(u=\cos \left ( \frac{2\pi }{L}nx\right ) ,du=-\frac{2\pi n}{L}\sin \left ( \frac{2\pi }{L}nx\right ) \) and \(dv=e^{x},v=e^{x}\). The above becomes\begin{align*} I & =-\frac{2\pi n}{L}\left ( \left [ e^{x}\cos \left ( \frac{2\pi }{L}nx\right ) \right ] _{-\frac{L}{2}}^{\frac{L}{2}}-\int _{-\frac{L}{2}}^{\frac{L}{2}}-\frac{2\pi n}{L}\sin \left ( \frac{2\pi }{L}nx\right ) e^{x}dx\right ) \\ & =-\frac{2\pi n}{L}\left ( 2\cos \left ( \pi n\right ) \sinh \left ( \frac{L}{2}\right ) +\frac{2\pi n}{L}\int _{-\frac{L}{2}}^{\frac{L}{2}}\sin \left ( \frac{2\pi }{L}nx\right ) e^{x}dx\right ) \end{align*}

But \(\int _{-\frac{L}{2}}^{\frac{L}{2}}\sin \left ( \frac{2\pi }{L}nx\right ) e^{x}dx=I\) and the above reduces to\begin{align*} I & =-\frac{2\pi n}{L}\left ( 2\cos \left ( \pi n\right ) \sinh \left ( \frac{L}{2}\right ) +\frac{2\pi n}{L}I\right ) \\ I & =-\frac{4\pi n}{L}\cos \left ( \pi n\right ) \sinh \left ( \frac{L}{2}\right ) -\frac{4\pi ^{2}n^{2}}{L^{2}}I\\ I\left ( 1+\frac{4\pi ^{2}n^{2}}{L^{2}}\right ) & =-\frac{4\pi n}{L}\cos \left ( \pi n\right ) \sinh \left ( \frac{L}{2}\right ) \\ I & =\frac{-\frac{4\pi n}{L}\cos \left ( \pi n\right ) \sinh \left ( \frac{L}{2}\right ) }{1+\frac{4\pi ^{2}n^{2}}{L^{2}}}\\ & =\frac{-4\pi nL\cos \left ( \pi n\right ) \sinh \left ( \frac{L}{2}\right ) }{L^{2}+4\pi ^{2}n^{2}} \end{align*}

Using the above in (2) gives\begin{align*} b_{n} & =\frac{2}{L}\frac{-4\pi nL\cos \left ( \pi n\right ) \sinh \left ( \frac{L}{2}\right ) }{L^{2}+4\pi ^{2}n^{2}}\\ & =\frac{-8\pi n}{L^{2}+4\pi ^{2}n^{2}}\cos \left ( \pi n\right ) \sinh \left ( \frac{L}{2}\right ) \end{align*}

Therefore, from (1A) the Fourier series is\begin{equation} f\left ( x\right ) =\frac{2}{L}\sinh \left ( \frac{L}{2}\right ) +\sum _{n=1}^{\infty }\frac{4L}{L^{2}+4\pi ^{2}n^{2}}\cos \left ( \pi n\right ) \sinh \left ( \frac{L}{2}\right ) \cos \left ( \frac{2\pi }{L}nx\right ) -\frac{8\pi n}{L^{2}+4\pi ^{2}n^{2}}\cos \left ( \pi n\right ) \sinh \left ( \frac{L}{2}\right ) \sin \left ( \frac{2\pi }{L}nx\right ) \tag{3} \end{equation} To verify the result, the above was plotted for increasing \(n\) against the original \(f\left ( x\right ) \) function to see how the approximation improves as \(n\) increases. Using \(L=2\), the result is displayed below. The original function is in the red color.

Compared to part (1), more terms are needed here to get good approximation. Since the original function is piecewise continuous when extending over multiple periods, the convergence is no longer a uniform convergence. At the point of discontinuity, the approximation converges to the average value of the original function at that point. At about \(20\) terms the approximation started to give good results. Due to Gibbs phenomena, at the points of discontinuities, the error is largest. Here is a plot showing one period

pict
Figure 3.16:Fourier series approximation, showing one period
pict
Figure 3.17:Code used

In the following plot, 3 periods are shown to make it easier to see the effect of discontinuities and the Gibbs phenomena

pict
Figure 3.18:Fourier series approximation, showing 3 periods
pict
Figure 3.19:Code used

3.5.2 Problem 2

Find the general solution of

1.
\(2x^{3}y^{\prime }=1+\sqrt{1+4x^{2}y}\)
2.
\(e^{x}\sin y-2y\sin x+\left ( y^{2}+e^{x}\cos y+2\cos y\right ) y^{\prime }=0\)
3.
\(y^{\prime }+y\cos x=\frac{1}{2}\sin x\)

Solution

part 1

This ODE is not separable and it is also not exact (It was checked for exactness and failed the test). The ODE is next checked to see if it is isobaric. An ODE \(y^{\prime }=f\left ( x,y\right ) \) is isobaric (which is a generalization of a homogeneous ODE) if the substitution \[ y\left ( x\right ) =v\left ( x\right ) x^{m}\] Changes the ODE to be a separable one in \(v\left ( x\right ) \). To determine if it isobaric, a weight \(m\) is assigned to \(y\) and to \(dy\), and a weight of \(1\) is assigned to \(x\) and to \(dx\), then if an \(m\) could be found such that each term in the ODE will have the same weight, then the ODE is isobaric and it can be made separable using the above substitution. Writing the above ODE as\begin{align*} 2x^{3}dy & =\left ( 1+\sqrt{1+4x^{2}y}\right ) dx\\ \overbrace{2x^{3}dy}-\overbrace{dx}-\overbrace{\sqrt{1+4x^{2}y}dx} & =0 \end{align*}

Adding the weights of the first term above gives \(2x^{3}dy\rightarrow 3+m\). The next term weight is \(dx\rightarrow 1\). The next term weight is \(\sqrt{1+4x^{2}y}dx\rightarrow \frac{1}{2}\left ( 2+m\right ) +1=2+\frac{m}{2}\). Therefore the weights of each term are\[ \{3+m,1,2+\frac{m}{2}\} \] Each term weight can be made the same by selecting \(m=-2\). This value makes each term have weight \(1\) and the above becomes\[ \{1,1,1\} \] Therefore the ODE is isobaric. Using this value of \(m\) the substitution \(y=\frac{v}{x^{2}}\) is now used to make the original ODE separable\[ \frac{dy}{dx}=\frac{1}{x^{2}}\frac{dv}{dx}-2\frac{v}{x^{3}}\] The original ODE now becomes (where each \(y\) is replaced by \(\frac{v}{x^{2}}\)) separable as follows\begin{align*} 2x^{3}\left ( \frac{1}{x^{2}}\frac{dv}{dx}-2\frac{v}{x^{3}}\right ) & =1+\sqrt{1+4x^{2}\frac{v}{x^{2}}}\\ 2x\frac{dv}{dx}-4v & =1+\sqrt{1+4v}\\ 2x\frac{dv}{dx} & =1+\sqrt{1+4v}+4v \end{align*}

Solving this ODE for \(v\left ( x\right ) \)\[ \frac{dv}{1+\sqrt{1+4v}+4v}=\frac{1}{2x}dx \] Integrating both sides gives\begin{equation} \int \frac{dv}{1+\sqrt{1+4v}+4v}=\frac{1}{2}\ln \left \vert x\right \vert +c \tag{2} \end{equation} The integral above is solved by substitution. Let \(\sqrt{1+4v}=u\), hence \(\frac{du}{dv}=\frac{1}{2}\frac{4}{\sqrt{1+4v}}=\frac{2}{u}\) or \(dv=\frac{1}{2}udu\). Squaring both sides of \(\sqrt{1+4v}=u\) (and assuming \(1+4v>0\)) gives \(1+4v=u^{2}\) or \(v=\frac{u^{2}-1}{4}\). Therefore the LHS integral in (2) becomes\begin{align*} \int \frac{1}{1+\sqrt{1+4v}+4v}dv & =\frac{1}{2}\int \frac{u}{1+u+4\left ( \frac{u^{2}-1}{4}\right ) }du\\ & =\frac{1}{2}\int \frac{u}{u+u^{2}}du\\ & =\frac{1}{2}\int \frac{1}{1+u}du\\ & =\frac{1}{2}\ln \left \vert 1+u\right \vert \end{align*}

Using this result in (2) gives the following (the absolute values are removed because the constant of integration absorbs the sign).\begin{align*} \frac{1}{2}\ln \left ( 1+u\right ) & =\frac{1}{2}\ln x+c\\ \ln \left ( 1+u\right ) & =\ln x+2c \end{align*}

Let \(2c=C_{0}\) be a new constant. The above becomes\begin{align*} \ln \left ( 1+u\right ) & =\ln x+C_{0}\\ e^{\ln \left ( 1+u\right ) } & =e^{\ln x+C_{0}}\\ 1+u & =e^{C_{0}}x\\ 1+u & =Cx \end{align*}

Where \(C=e^{C_{0}}\) is a new constant. Therefore the solution is\[ u\left ( x\right ) =Cx-1 \] Since \(u\left ( x\right ) =\sqrt{1+4v}\) then the above becomes\begin{align*} \sqrt{1+4v} & =Cx-1\\ 1+4v & =\left ( Cx-1\right ) ^{2}\\ v\left ( x\right ) & =\frac{\left ( Cx-1\right ) ^{2}-1}{4} \end{align*}

But \(y=\frac{v}{x^{2}}\) therefore the above gives the final solution as\[ y\left ( x\right ) =\frac{\left ( Cx-1\right ) ^{2}-1}{4x^{2}}\] Where \(C\) is the constant of integration.

Part 2

\[ e^{x}\sin y-2y\sin x+\left ( y^{2}+e^{x}\cos y+2\cos x\right ) y^{\prime }=0 \] The first step is to write the ODE in standard form to check if it is an exact ODE\[ M(x,y)dx+N(x,y)dy=0 \] Hence\begin{align*} M(x,y) & =e^{x}\sin y-2\,y\sin x\\ N(x,y) & ={y}^{2}+e^{x}\cos y+2\,\cos x \end{align*}

Next, the ODE is determined if it is exact or not. The ODE is exact if the following condition is satisfied \[ \frac{\partial M}{\partial y}=\frac{\partial N}{\partial x}\] Applying the above on the given ODE results in\begin{align*} \frac{\partial M}{\partial y} & =e^{x}\cos y-2\,\sin x\\ \frac{\partial N}{\partial x} & =e^{x}\cos y-2\,\sin x \end{align*}

Because \(\frac{\partial M}{\partial y}=\frac{\partial N}{\partial x}\), then the ODE is exact. The following equations are used to solve for the function \(\phi \left ( x,y\right ) \) \begin{align} \frac{\partial \phi }{\partial x} & =M=e^{x}\sin y-2\,y\sin x\tag{3}\\ \frac{\partial \phi }{\partial y} & =N={y}^{2}+e^{x}\cos y+2\,\cos x \tag{4} \end{align}

Integrating (3) w.r.t \(x\) gives \begin{align} \int \frac{\partial \phi }{\partial x}dx & =\int e^{x}\sin y-2\,y\sin xdx\nonumber \\ \phi \left ( x,y\right ) & =e^{x}\sin y+2\,y\cos x+f(y) \tag{5} \end{align}

Where \(f(y)\) is used as the constant of integration because \(\phi \left ( x,y\right ) \) is a function of both \(x\) and \(y\). Taking derivative of (5) w.r.t \(y\) gives\begin{equation} \frac{\partial \phi }{\partial y}=e^{x}\cos y+2\,\cos x+f^{\prime }(y) \tag{6} \end{equation} But (4) says that \(\frac{\partial \phi }{\partial y}={y}^{2}+e^{x}\cos y+2\,\cos x\). Therefore by equating (4) and (6) then \(f^{\prime }\left ( y\right ) \) can be solved for:\begin{equation}{y}^{2}+e^{x}\cos y+2\,\cos x=e^{x}\cos y+2\,\cos x+f^{\prime }(y) \tag{7} \end{equation} Solving the above for \(f^{\prime }(y)\) gives \[ f^{\prime }(y)={y}^{2}\] Integrating w.r.t \(y\) gives \(f\left ( y\right ) \) \begin{align*} \int f^{\prime }dy & =\int{y}^{2}dy\\ f(y) & =\frac{1}{3}\,{y}^{3}+C_{1} \end{align*}

Where \(C_{1}\) is constant of integration. Substituting the value of \(f(y)\) back into (5) gives \(\phi \left ( x,y\right ) \)\[ \phi =e^{x}\sin y+2\,y\cos x+\frac{1}{3}\,{y}^{3}+C_{1}\] But since \(\phi \) itself is a constant function, say \(\phi =C_{0}\) where \(C_{0}\) is new constant, then by combining \(C_{1}\) and \(C_{0}\) constants into a new constant \(C_{1}\), the above gives the solution\[ C_{1}=e^{x}\sin y\left ( x\right ) +2\,y\left ( x\right ) \cos x+\frac{1}{3}\,{y}^{3}\left ( x\right ) \] The above is left in implicit form for simplicity.

Part 3

\[ y^{\prime }+y\cos x=\frac{1}{2}\sin \left ( 2x\right ) \] This ODE is linear  in \(y\). It is solved using an integrating factor \(\mu =e^{\int \cos xdx}=e^{\sin x}\). Multiplying both sides of the ODE by \(\mu \) makes the left side an exact differential \[ d\left ( y\mu \right ) =\frac{1}{2}\mu \sin \left ( 2\right ) xdx \] Integrating both sides gives\begin{align} y\mu & =\frac{1}{2}\int \mu \sin \left ( 2x\right ) dx+C\nonumber \\ ye^{\sin x} & =\frac{1}{2}\int e^{\sin x}\sin \left ( 2x\right ) dx+C \tag{1} \end{align}

The above integral can be solved as follows. Since \(\sin \left ( 2x\right ) =2\sin x\cos x\) therefore then\[ I=\frac{1}{2}\int e^{\sin x}\sin \left ( 2x\right ) dx=\int e^{\sin x}\sin x\cos xdx \] Using the substitution \(z=\sin x\), then \(dz=dx\cos x\) and the above becomes\[ I=\int e^{z}zdz \] Integrating the above by parts: \(\int udv=uv-\int vdu\). Let \(u=z,dv=e^{z}\rightarrow du=1,v=e^{z}\), and the above becomes\begin{align*} I & =ze^{z}-\int e^{z}dz\\ & =ze^{z}-e^{z}\\ & =e^{z}\left ( z-1\right ) \end{align*}

Since \(z=\sin x\) the above reduces to\[ I=e^{\sin x}\left ( \sin \left ( x\right ) -1\right ) \] Substituting this back in (1) results in\[ ye^{\sin x}=e^{\sin x}\left ( \sin \left ( x\right ) -1\right ) +C \] Therefore the final solution is\[ y\left ( x\right ) =\sin \left ( x\right ) -1+Ce^{-\sin x}\] Where \(C\) is the constant of integration.

3.5.3 Problem 3

Find general solution of

1.
\(y^{\prime \prime \prime }-4y^{\prime \prime }-4y^{\prime }+16=8\sin x\)
2.
\(a^{2}y^{\prime 2}=\left ( 1+y^{\prime 2}\right ) ^{3}\)

Solution

Part 1

\[ y^{\prime \prime \prime }-4y^{\prime \prime }-4y^{\prime }=8\sin x-16 \] This is linear nonhomogeneous ODE with constant coefficients. Solving first the homogeneous ODE \(y^{\prime \prime \prime }-4y^{\prime \prime }-4y^{\prime }=0\). Since the term \(y\) is missing from the ODE then the substitution \(y^{\prime }=u\) reduces the ODE to a second order ODE\begin{equation} u^{\prime \prime }-4u^{\prime }-4u=0 \tag{1} \end{equation} Let \(u=e^{\lambda x}\). Substituting this into the above and simplifying gives the characteristic equation\[ \lambda ^{2}-4\lambda -4=0 \] The Roots are \(\lambda =-\frac{b}{2a}\pm \frac{1}{2a}\sqrt{b^{2}-4ac}\) or \begin{align*} \lambda & =\frac{4}{2}\pm \frac{1}{2}\sqrt{16-4\left ( -4\right ) }\\ & =2\pm \frac{1}{2}\sqrt{32}\\ & =2\pm 2\sqrt{2}\\ & =2\left ( 1\pm \sqrt{2}\right ) \end{align*}

Hence the solution to (1) is given by linear combinations of \(e^{\lambda _{1}x},e^{\lambda _{2}x}\) as\[ u_{h}\left ( x\right ) =c_{1}e^{2\left ( 1+\sqrt{2}\right ) x}+c_{2}e^{2\left ( 1-\sqrt{2}\right ) x}\] But since \(y^{\prime }=u\), then \(y\) is found by integrating the above\begin{align*} y_{h} & =\int c_{1}e^{2\left ( 1+\sqrt{2}\right ) x}+c_{2}e^{2\left ( 1-\sqrt{2}\right ) x}dx\\ & =c_{1}\frac{e^{2\left ( 1+\sqrt{2}\right ) x}}{2\left ( 1+\sqrt{2}\right ) }+c_{2}\frac{e^{\left ( 2-2\sqrt{2}\right ) x}}{2\left ( 1-\sqrt{2}\right ) }+C_{3} \end{align*}

To simplify the above, let \(\frac{c_{1}}{2\left ( 1+\sqrt{2}\right ) }=C_{1},\frac{c_{2}}{2\left ( 1-\sqrt{2}\right ) }=C_{2}\), where \(C_{1},C_{2}\) are new constants. The above simplifies to\[ y_{h}=C_{1}e^{2\left ( 1+\sqrt{2}\right ) x}+C_{2}e^{\left ( 2-2\sqrt{2}\right ) x}+C_{3}\] The above solution is homogeneous solution to the original ODE. Next, the particular solution is found. Since the RHS of the original ODE is \(\sin x-16\) then choosing \(y_{p}\) to have the form\[ y_{p}=A\sin x+B\cos x+kx \] Therefore\begin{align*} y_{p}^{\prime } & =k+A\cos x-B\sin x\\ y_{p}^{\prime \prime } & =-A\sin x-B\cos x\\ y_{p}^{\prime \prime \prime } & =-A\cos x+B\sin x \end{align*}

Substituting these back into the original ODE \(y^{\prime \prime \prime }-4y^{\prime \prime }-4y^{\prime }=8\sin x-16\) gives\begin{align*} \left ( -A\cos x+B\sin x\right ) -4\left ( -A\sin x-B\cos x\right ) -4\left ( k+A\cos x-B\sin x\right ) & =8\sin x-16\\ -A\cos x+B\sin x+4A\sin x+4B\cos x-4A\cos x+4B\sin x-4k & =8\sin x-16\\ \cos x\left ( -A+4B-4A\right ) +\sin x\left ( B+4A+4B\right ) -4k & =8\sin x-16\\ \cos x\left ( -5A+4B\right ) +\sin x\left ( 5B+4A\right ) -4k & =8\sin x-16 \end{align*}

Comparing coefficients gives the following equations to solve for the unknowns \(A,B,k\)\begin{align*} -4k & =-16\\ -5A+4B & =0\\ 5B+4A & =8 \end{align*}

The second equation gives \(B=\frac{5}{4}A\). Using this in the third equation gives \(5\left ( \frac{5}{4}A\right ) +4A=8\), solving gives \(A=\frac{32}{41}\). Hence \(B=\frac{5}{4}\left ( \frac{32}{41}\right ) =\frac{40}{41}\). The first equation gives \(k=4\). Therefore the particular solution is\begin{align*} y_{p} & =A\sin x+B\cos x+kx\\ & =\frac{32}{41}\sin x+\frac{40}{41}\cos x+4x \end{align*}

Now that \(y_{h}\) and \(y_{p}\) are found, the general solution is found as \begin{align*} y & =y_{h}+y_{p}\\ & =C_{1}e^{2\left ( 1+\sqrt{2}\right ) x}+C_{2}e^{\left ( 2-2\sqrt{2}\right ) x}+C_{3}+\frac{32}{41}\sin x+\frac{40}{41}\cos x+4x \end{align*}

Where \(C_{1},C_{2}\) are the two constants of integration.

Part 2

\[ a^{2}y^{\prime 2}=\left ( 1+y^{\prime 2}\right ) ^{3}\] Let \(y^{\prime }=A\), the above becomes \begin{align*} a^{2}A^{2} & =\left ( 1+A^{2}\right ) ^{3}\\ & =1+3A^{2}+\frac{\left ( 3\right ) \left ( 2\right ) }{2!}A^{4}+\frac{\left ( 3\right ) \left ( 2\right ) \left ( 1\right ) }{3!}A^{6}\\ & =1+3A^{2}+3A^{4}+A^{6} \end{align*}

Hence the polynomial is \[ A^{6}+3A^{4}+A^{2}\left ( 3-a^{2}\right ) +1=0 \] Let \(A^{2}=B\) and the above becomes\[ B^{3}+3B^{2}+B\left ( 3-a^{2}\right ) +1=0 \] With the help of the computer, the cubic roots of the above are

\begin{align*} B_{1} & =\sqrt [3]{\sqrt{\frac{1}{4}a^{4}-\frac{1}{27}a^{6}}-\frac{1}{2}a^{2}}+\frac{1}{3}\frac{a^{2}}{\sqrt [3]{\sqrt{\frac{1}{4}a^{4}-\frac{1}{27}a^{6}}-\frac{1}{2}a^{2}}}-1\\ B_{2} & =\frac{1}{2}i\sqrt{3}\left ( \sqrt [3]{\sqrt{\frac{1}{4}a^{4}-\frac{1}{27}a^{6}}-\frac{1}{2}a^{2}}-\frac{1}{3}\frac{a^{2}}{\sqrt [3]{\sqrt{\frac{1}{4}a^{4}-\frac{1}{27}a^{6}}-\frac{1}{2}a^{2}}}\right ) -\frac{1}{2}\sqrt [3]{\sqrt{\frac{1}{4}a^{4}-\frac{1}{27}a^{6}}-\frac{1}{2}a^{2}}-\frac{1}{6}\frac{a^{2}}{\sqrt [3]{\sqrt{\frac{1}{4}a^{4}-\frac{1}{27}a^{6}}-\frac{1}{2}a^{2}}}-1\\ B_{3} & =-\frac{1}{2}\sqrt [3]{\sqrt{\frac{1}{4}a^{4}-\frac{1}{27}a^{6}}-\frac{1}{2}a^{2}}-\frac{1}{2}i\sqrt{3}\left ( \sqrt [3]{\sqrt{\frac{1}{4}a^{4}-\frac{1}{27}a^{6}}-\frac{1}{2}a^{2}}-\frac{1}{3}\frac{a^{2}}{\sqrt [3]{\sqrt{\frac{1}{4}a^{4}-\frac{1}{27}a^{6}}-\frac{1}{2}a^{2}}}\right ) -\frac{1}{6}\frac{a^{2}}{\sqrt [3]{\sqrt{\frac{1}{4}a^{4}-\frac{1}{27}a^{6}}-\frac{1}{2}a^{2}}}-1 \end{align*}

Therefore \(A_{1}=\pm \sqrt{B_{1}},A_{2}=\pm \sqrt{B_{2}},A_{3}=\pm \sqrt{B_{3}}\) or, since \(y^{\prime }\left ( x\right ) =A\,\), then there are 6 solutions, each is a solution for one root.\begin{align*} \frac{dy_{1}}{dx} & =+\sqrt{B_{1}}\\ \frac{dy_{2}}{dx} & =-\sqrt{B_{1}}\\ \frac{dy_{3}}{dx} & =+\sqrt{B_{2}}\\ \frac{dy_{4}}{dx} & =-\sqrt{B_{2}}\\ \frac{dy_{5}}{dx} & =+\sqrt{B_{3}}\\ \frac{dy_{6}}{dx} & =-\sqrt{B_{3}} \end{align*}

But the roots \(\pm B_{i}\) are constants. Therefore each of the above can be solved by direct integration. The final solution which gives the solutions\begin{align*} y_{1} & =\sqrt{B_{1}}x+C_{1}\\ y_{2} & =-\sqrt{B_{1}}x+C_{2}\\ y_{3} & =\sqrt{B_{2}}x+C_{3}\\ y_{4} & =-\sqrt{B_{2}}x+C_{4}\\ y_{5} & =\sqrt{B_{3}}x+C_{5}\\ y_{6} & =-\sqrt{B_{3}}x+C_{6} \end{align*}

Where the constants \(B_{i}\) are given above.

3.5.4 key solution to HW 5

key.pdf