### 3.3 HW3

3.3.2 problem 9.4(b)
3.3.3 problem 9.6
3.3.4 problem 9.9
3.3.5 problem 9.15(b)
3.3.6 problem 9.19

PDF (letter size)
PDF (legal size)

#### 3.3.1 problem 9.3 (page 479)

3.3.1.1 Part a
3.3.1.2 Part b
3.3.1.3 Part c

problem (a) show that if $$a\left ( x\right ) <0$$ for $$0\leq x\leq 1$$ then the solution to 9.1.7 has boundary layer at $$x=1$$. (b) Find a uniform approximation with error $$O\left ( \varepsilon \right )$$ to the solution 9.1.7 when $$a\left ( x\right ) <0$$ for $$0\leq x\leq 1$$ (c) Show that if $$a\left ( x\right ) >0$$ it is impossible to match to a boundary layer at $$x=1$$

solution

##### 3.3.1.1 Part a

Equation 9.1.7 at page 422 is\begin{align} \varepsilon y^{\prime \prime }+a\left ( x\right ) y^{\prime }+b\left ( x\right ) y\left ( x\right ) & =0\tag{9.1.7}\\ y\left ( 0\right ) & =A\nonumber \\ y\left ( 1\right ) & =B\nonumber \end{align}

For $$0\leq x\leq 1$$.  Now we solve for $$y_{in}\left ( x\right )$$, but ﬁrst we introduce inner variable $$\xi$$. We assume boundary layer is at $$x=0$$, then show that this leads to inconsistency. Let $$\xi =\frac{x}{\varepsilon ^{p}}$$ be the inner variable. We express the original ODE using this new variable. We also need to determine $$p$$.  Since $$\frac{dy}{dx}=\frac{dy}{d\xi }\frac{d\xi }{dx}$$ then $$\frac{dy}{dx}=\frac{dy}{d\xi }\varepsilon ^{-p}$$. Hence $$\frac{d}{dx}\equiv \varepsilon ^{-p}\frac{d}{d\xi }$$\begin{align*} \frac{d^{2}}{dx^{2}} & =\frac{d}{dx}\frac{d}{dx}\\ & =\left ( \varepsilon ^{-p}\frac{d}{d\xi }\right ) \left ( \varepsilon ^{-p}\frac{d}{d\xi }\right ) \\ & =\varepsilon ^{-2p}\frac{d^{2}}{d\xi ^{2}} \end{align*}

Therefore $$\frac{d^{2}y}{dx^{2}}=\varepsilon ^{-2p}\frac{d^{2}y}{d\xi ^{2}}$$ and (9.1.7) becomes\begin{align*} \varepsilon \varepsilon ^{-2p}\frac{d^{2}y}{d\xi ^{2}}+a\left ( x\right ) \varepsilon ^{-p}\frac{dy}{d\xi }+y & =0\\ \varepsilon ^{1-2p}\frac{d^{2}y}{d\xi ^{2}}+a\left ( x\right ) \varepsilon ^{-p}\frac{dy}{d\xi }+y & =0 \end{align*}

The largest terms are $$\left \{ \varepsilon ^{1-2p},\varepsilon ^{-p}\right \}$$, therefore balance gives $$1-2p=-p$$ or $$p=1$$. The ODE now becomes$$\varepsilon ^{-1}\frac{d^{2}y}{d\xi ^{2}}+a\left ( x\right ) \varepsilon ^{-1}\frac{dy}{d\xi }+y=0 \tag{1}$$ Assuming that$y_{in}\left ( x\right ) =\sum _{n=0}^{\infty }\varepsilon ^{n}y_{n}=y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots$ And substituting the above into (1) gives$$\varepsilon ^{-1}\left ( y_{0}^{\prime \prime }+\varepsilon y_{1}^{\prime \prime }+\cdots \right ) +a\left ( x\right ) \varepsilon ^{-1}\left ( y_{0}^{\prime }+\varepsilon y_{1}^{\prime }+\cdots \right ) +\left ( y_{0}+\varepsilon y_{1}+\cdots \right ) =0 \tag{1A}$$ Collecting powers of $$O\left ( \varepsilon ^{-1}\right )$$ terms, gives the ODE to solve for $$y_{0}^{in}$$ as$y_{0}^{\prime \prime }\thicksim -a\left ( x\right ) y_{0}^{\prime }$ In the rapidly changing region, because the boundary layer is very thin, we can approximate $$a\left ( x\right )$$ by $$a\left ( 0\right )$$. The above becomes$y_{0}^{\prime \prime }\thicksim -a\left ( 0\right ) y_{0}^{\prime }$ But we are told that $$a\left ( x\right ) <0$$, so $$a\left ( 0\right ) <0$$, hence $$-a\left ( 0\right )$$ is positive. Let $$-a\left ( 0\right ) =n^{2}$$, to make it more clear this is positive, then the ODE to solve is $y_{0}^{\prime \prime }\thicksim n^{2}y_{0}^{\prime }$ The solution to this ODE is$y_{0}\left ( \xi \right ) \thicksim \frac{C_{1}}{n^{2}}e^{n^{2}\xi }+C_{2}$ Using $$y\left ( 0\right ) =A$$, then the above gives $$A=\frac{C_{1}}{n^{2}}+C_{2}$$ or $$C_{2}=A-\frac{C_{1}}{n^{2}}$$ and the ODE becomes\begin{align*} y_{0}\left ( \xi \right ) & \thicksim \frac{C_{1}}{n^{2}}e^{n^{2}\xi }+\left ( A-\frac{C_{1}}{n^{2}}\right ) \\ & \thicksim \frac{C_{1}}{n^{2}}\left ( e^{n^{2}\xi }-1\right ) +A \end{align*}

We see from the above solution for the inner layer, that as $$\xi$$ increases (meaning we are moving away from $$x=0)$$, then the solution $$y_{0}\left ( \xi \right )$$ and its derivative is increasing and not decreasing since $$y_{0}^{\prime }\left ( \xi \right ) =C_{1}e^{n^{2}\xi }$$ and $$y_{0}^{\prime \prime }\left ( \xi \right ) =C_{1}n^{2}e^{n^{2}\xi }$$.

But this contradicts what we assumed that the boundary layer is at $$x=0\,$$ since we expect the solution to change less rapidly as we move away from $$x=0$$. Hence we conclude that if $$a\left ( x\right ) <0$$, then the boundary layer can not be at $$x=0$$.

Let us now see what happens by taking the boundary layer to be at $$x=1$$. We repeat the same process as above, but now the inner variable as deﬁned as

$\xi =\frac{1-x}{\varepsilon ^{p}}$ We express the original ODE using this new variable and determine $$p$$.  Since $$\frac{dy}{dx}=\frac{dy}{d\xi }\frac{d\xi }{dx}$$ then $$\frac{dy}{dx}=\frac{dy}{d\xi }\left ( -\varepsilon ^{-p}\right )$$. Hence $$\frac{d}{dx}\equiv \left ( -\varepsilon ^{-p}\right ) \frac{d}{d\xi }$$\begin{align*} \frac{d^{2}}{dx^{2}} & =\frac{d}{dx}\frac{d}{dx}\\ & =\left ( \left ( -\varepsilon ^{-p}\right ) \frac{d}{d\xi }\right ) \left ( \left ( -\varepsilon ^{-p}\right ) \frac{d}{d\xi }\right ) \\ & =\varepsilon ^{-2p}\frac{d^{2}}{d\xi ^{2}} \end{align*}

Therefore $$\frac{d^{2}y}{dx^{2}}=\varepsilon ^{-2p}\frac{d^{2}y}{d\xi ^{2}}$$ and equation (9.1.7) becomes\begin{align*} \varepsilon \varepsilon ^{-2p}\frac{d^{2}y}{d\xi ^{2}}-a\left ( x\right ) \varepsilon ^{-p}\frac{dy}{d\xi }+y & =0\\ \varepsilon ^{1-2p}\frac{d^{2}y}{d\xi ^{2}}-a\left ( x\right ) \varepsilon ^{-p}\frac{dy}{d\xi }+y & =0 \end{align*}

The largest terms are $$\left \{ \varepsilon ^{1-2p},\varepsilon ^{-p}\right \}$$, therefore matching them gives $$1-2p=-p$$ or $\fbox{p=1}$ The ODE now becomes$$\varepsilon ^{-1}\frac{d^{2}y}{d\xi ^{2}}-a\left ( x\right ) \varepsilon ^{-1}\frac{dy}{d\xi }+y=0 \tag{2}$$ Assuming that$y_{in}\left ( x\right ) =\sum _{n=0}^{\infty }\varepsilon ^{n}y_{n}=y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots$ And substituting the above into (2) gives$$\varepsilon ^{-1}\left ( y_{0}^{\prime \prime }+\varepsilon y_{1}^{\prime \prime }+\cdots \right ) -a\left ( x\right ) \varepsilon ^{-1}\left ( y_{0}^{\prime }+\varepsilon y_{1}^{\prime }+\cdots \right ) +\left ( y_{0}+\varepsilon y_{1}+\cdots \right ) =0 \tag{2A}$$ Collecting $$O\left ( \varepsilon ^{-1}\right )$$ terms, gives the ODE to solve for $$y_{0}^{in}$$ as$y_{0}^{\prime \prime }\thicksim a\left ( x\right ) y_{0}^{\prime }$ In the rapidly changing region, $$\alpha =a\left ( 1\right )$$, because the boundary layer is very thin, we approximated $$a\left ( x\right )$$ by $$a\left ( 1\right )$$. The above becomes$y_{0}^{\prime \prime }\thicksim \alpha y_{0}^{\prime }$ But we are told that $$a\left ( x\right ) <0$$, so $$\alpha <0$$, and the above becomes$y_{0}^{\prime \prime }\thicksim \alpha y_{0}^{\prime }$ The solution to this ODE is$$y_{0}\left ( \xi \right ) \thicksim \frac{C_{1}}{\alpha }e^{\alpha \xi }+C_{2} \tag{3}$$ Using \begin{align*} y\left ( x=1\right ) & =y\left ( \xi =0\right ) \\ & =B \end{align*}

Then (3) gives $$B=\frac{C_{1}}{\alpha }+C_{2}$$ or $$C_{2}=B-\frac{C_{1}}{\alpha }$$ and (3) becomes\begin{align} y_{0}\left ( \xi \right ) & \thicksim \frac{C_{1}}{\alpha }e^{\alpha \xi }+\left ( B-\frac{C_{1}}{\alpha }\right ) \nonumber \\ & \thicksim \frac{C_{1}}{\alpha }\left ( e^{\alpha \xi }-1\right ) +B \tag{4} \end{align}

From the above, $$y_{0}^{\prime }\left ( \xi \right ) =-C_{1}e^{\alpha \xi }$$ and $$y_{0}^{\prime \prime }\left ( \xi \right ) =C_{1}\alpha e^{\alpha \xi }$$. We now see that as that as $$\xi$$ increases (meaning we are moving away from $$x=1$$ towards the left$$)$$, then the solution $$y_{0}\left ( \xi \right )$$ is actually changing less rapidly. This is because $$\alpha <0$$. The solution is changing less rapidly as we move away from the boundary layer as what we expect. Therefore, we conclude that if $$a\left ( x\right ) <0$$ then the boundary layer can not be at $$x=0$$ and has to be at $$x=1$$.

##### 3.3.1.2 Part b

To ﬁnd uniform approximation, we need now to ﬁnd $$y^{out}\left ( x\right )$$ and then do the matching. Since from part(a) we concluded that $$y_{in}$$ is near $$x=1$$, then we assume now that $$y^{out}\left ( x\right )$$ is near $$x=0$$. Let$y_{out}\left ( x\right ) =\sum _{n=0}^{\infty }\varepsilon ^{n}y_{n}=y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots$ Substituting this into (9.1.7) gives$$\varepsilon \left ( y_{0}^{\prime \prime }+\varepsilon y_{1}^{\prime \prime }+\varepsilon ^{2}y_{2}^{\prime \prime }+\cdots \right ) +a\left ( x\right ) \left ( y_{0}^{\prime }+\varepsilon y_{1}^{\prime }+\varepsilon ^{2}y_{2}^{\prime }+\cdots \right ) +b\left ( x\right ) \left ( y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots \right ) =0\nonumber$$ Collecting terms of $$O\left ( 1\right )$$ gives the ODE$a\left ( x\right ) y_{0}^{\prime }+b\left ( x\right ) y_{0}=0$ The solution to this ODE is $y_{0}\left ( x\right ) =C_{2}e^{-\int _{0}^{x}\frac{b\left ( s\right ) }{a\left ( s\right ) }ds}$ Applying $$y\left ( 0\right ) =A$$ gives\begin{align*} A & =C_{2}e^{-\int _{0}^{1}\frac{b\left ( s\right ) }{a\left ( s\right ) }ds}\\ & =C_{2}E \end{align*}

Where $$E$$ is constant, which is the value of the deﬁnite integral $$E=e^{-\int _{0}^{1}\frac{b\left ( s\right ) }{a\left ( s\right ) }ds}$$. Hence the solution $$y^{out}\left ( x\right )$$ can now be written as$y_{0}^{out}\left ( x\right ) =\frac{A}{E}e^{-\int _{0}^{x}\frac{b\left ( s\right ) }{a\left ( s\right ) }ds}$ We are now ready to do the matching.\begin{align*} \lim _{\xi \rightarrow \infty }y^{in}\left ( \xi \right ) & \thicksim \lim _{x\rightarrow 0}y^{out}\left ( x\right ) \\ \lim _{\xi \rightarrow \infty }\frac{C_{1}}{\alpha }\left ( e^{\alpha \xi }-1\right ) +B & \thicksim \lim _{x\rightarrow 0}\frac{A}{E}e^{-\int _{0}^{x}\frac{b\left ( s\right ) }{a\left ( s\right ) }ds} \end{align*}

But since $$\alpha =a\left ( 1\right ) <0$$ then the above simpliﬁes to\begin{align*} -\frac{C_{1}}{a\left ( 1\right ) }+B & =\frac{A}{E}\\ C_{1} & =-a\left ( 1\right ) \left ( \frac{A}{E}-B\right ) \end{align*}

Hence inner solution becomes \begin{align*} y_{0}^{in}\left ( \xi \right ) & \thicksim \frac{-a\left ( 1\right ) \left ( \frac{A}{E}-B\right ) }{a\left ( 1\right ) }\left ( e^{a\left ( 1\right ) \xi }-1\right ) +B\\ & \thicksim \left ( B-\frac{A}{E}\right ) \left ( e^{a\left ( 1\right ) \xi }-1\right ) +B\\ & \thicksim B\left ( e^{a\left ( 1\right ) \xi }-1\right ) -\frac{A}{E}\left ( e^{a\left ( 1\right ) \xi }-1\right ) +B\\ & \thicksim \left ( B-\frac{A}{E}\right ) \left ( e^{a\left ( 1\right ) \xi }-1\right ) +B \end{align*}

The uniform solution is\begin{align*} y_{\text{uniform}}\left ( x\right ) & \thicksim y^{in}\left ( \xi \right ) +y^{out}\left ( x\right ) -y^{match}\\ & \thicksim \overset{y^{in}}{\overbrace{\left ( B-\frac{A}{E}\right ) \left ( e^{a\left ( 1\right ) \xi }-1\right ) +B}}+\overset{y^{out}}{\overbrace{\frac{A}{E}e^{-\int _{0}^{x}\frac{b\left ( s\right ) }{a\left ( s\right ) }ds}}}-\frac{A}{E} \end{align*}

Or in terms of $$x$$ only$y_{\text{uniform}}\left ( x\right ) \thicksim \left ( B-\frac{A}{E}\right ) \left ( e^{a\left ( 1\right ) \frac{1-x}{\varepsilon }}-1\right ) +B+\frac{A}{E}e^{-\int _{0}^{x}\frac{b\left ( s\right ) }{a\left ( s\right ) }ds}-\frac{A}{E}$

##### 3.3.1.3 Part c

We now assume the boundary layer is at $$x=1$$ but $$a\left ( x\right ) >0$$. From part (a), we found that the solution for $$y_{0}^{in}\left ( \xi \right )$$ where boundary layer at $$x=1$$ is$$y_{0}\left ( \xi \right ) \thicksim \frac{C_{1}}{\alpha }\left ( e^{\alpha \xi }-1\right ) +B\nonumber$$ But now $$\alpha =a\left ( 1\right ) >0$$ and not negative as before. We also found that $$y_{0}^{out}\left ( x\right )$$ solution was $y_{0}^{out}\left ( x\right ) =\frac{A}{E}e^{-\int _{0}^{x}\frac{b\left ( s\right ) }{a\left ( s\right ) }ds}$ Lets now try to do the matching and see what happens\begin{align*} \lim _{\xi \rightarrow \infty }y^{in}\left ( \xi \right ) & \thicksim \lim _{x\rightarrow 0}y^{out}\left ( x\right ) \\ \lim _{\xi \rightarrow \infty }\frac{C_{1}}{\alpha }\left ( e^{\alpha \xi }-1\right ) +B+O\left ( \varepsilon \right ) & \thicksim \lim _{x\rightarrow 0}\frac{A}{E}e^{-\int _{0}^{x}\frac{b\left ( s\right ) }{a\left ( s\right ) }ds}+O\left ( \varepsilon \right ) \\ \lim _{\xi \rightarrow \infty }C_{1}\left ( \frac{e^{\alpha \xi }}{\alpha }-\frac{1}{\alpha }\right ) & \thicksim \frac{A}{E}-B \end{align*}

Since now $$\alpha >0$$, then the term on the left blows up, while the term on the right is ﬁnite. Not possible to match, unless $$C_{1}=0$$. But this means the boundary layer solution is just a constant $$B$$ and that $$\frac{A}{E}=B$$. So the matching does not work in general for arbitrary conditions. This means if $$a\left ( x\right ) >0$$, it is not possible to match boundary layer at $$x=1$$.

#### 3.3.2 problem 9.4(b)

Problem Find the leading order uniform asymptotic approximation to the solution of\begin{align} \varepsilon y^{\prime \prime }+\left ( 1+x^{2}\right ) y^{\prime }-x^{3}y\left ( x\right ) & =0\tag{1}\\ y\left ( 0\right ) & =1\nonumber \\ y\left ( 1\right ) & =1\nonumber \end{align}

For $$0\leq x\leq 1$$ in the limit as $$\varepsilon \rightarrow 0$$.

solution

Since $$a\left ( x\right ) =\left ( 1+x^{2}\right )$$ is positive, we expect the boundary layer to be near $$x=0$$. First we ﬁnd $$y^{out}\left ( x\right )$$, which is near $$x=1$$. Assuming$y_{out}\left ( x\right ) =\sum _{n=0}^{\infty }\varepsilon ^{n}y_{n}=y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots$ And substituting this into (1) gives$$\varepsilon \left ( y_{0}^{\prime \prime }+\varepsilon y_{1}^{\prime \prime }+\varepsilon ^{2}y_{2}^{\prime \prime }+\cdots \right ) +\left ( 1+x^{2}\right ) \left ( y_{0}^{\prime }+\varepsilon y_{1}^{\prime }+\varepsilon ^{2}y_{2}^{\prime }+\cdots \right ) -x^{3}\left ( y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots \right ) =0\nonumber$$ Collecting terms in $$O\left ( 1\right )$$ gives the ODE$\left ( 1+x^{2}\right ) y_{0}^{\prime }\thicksim x^{3}y_{0}$ The ODE becomes $$y_{0}^{\prime }\thicksim \frac{x^{3}}{\left ( 1+x^{2}\right ) }y_{0}$$ with integrating factor $$\mu =e^{\int \frac{-x^{3}}{\left ( 1+x^{2}\right ) }dx}$$ . To evaluate $$\int \frac{-x^{3}}{\left ( 1+x^{2}\right ) }dx$$, let $$u=x^{2}$$, hence $$\frac{du}{dx}=2x$$ and the integral becomes$\int \frac{-x^{3}}{\left ( 1+x^{2}\right ) }dx=-\int \frac{ux}{\left ( 1+u\right ) }\frac{du}{2x}=-\frac{1}{2}\int \frac{u}{\left ( 1+u\right ) }du$ But \begin{align*} \int \frac{u}{\left ( 1+u\right ) }du & =\int 1-\frac{1}{\left ( 1+u\right ) }du\\ & =u-\ln \left ( 1+u\right ) \end{align*}

But $$u=x^{2}$$, hence$\int \frac{-x^{3}}{\left ( 1+x^{2}\right ) }dx=\frac{-1}{2}\left ( x^{2}-\ln \left ( 1+x^{2}\right ) \right )$ Therefore the integrating factor is $$\mu =\exp \left ( \frac{-1}{2}x^{2}+\frac{1}{2}\ln \left ( 1+x^{2}\right ) \right )$$. The ODE becomes\begin{align*} \frac{d}{dx}\left ( \mu y_{0}\right ) & =0\\ \mu y_{0} & \thicksim c\\ y_{out}\left ( x\right ) & \thicksim c\exp \left ( \frac{1}{2}x^{2}-\frac{1}{2}\ln \left ( 1+x^{2}\right ) \right ) \\ & \thicksim ce^{\frac{1}{2}x^{2}}e^{\ln \left ( 1+x^{2}\right ) ^{\frac{-1}{2}}}\\ & \thicksim c\frac{e^{\frac{x^{2}}{2}}}{\sqrt{1+x^{2}}} \end{align*}

To ﬁnd $$c$$, using boundary conditions $$y\left ( 1\right ) =1$$ gives\begin{align*} 1 & =c\frac{e^{\frac{1}{2}}}{\sqrt{2}}\\ c & =\sqrt{2}e^{-\frac{1}{2}} \end{align*}

Hence $y_{0}^{out}\left ( x\right ) \thicksim \sqrt{2}\frac{e^{\frac{x^{2}-1}{2}}}{\sqrt{1+x^{2}}}$ Now we ﬁnd $$y^{in}\left ( x\right )$$ near $$x=0$$. Let $$\xi =\frac{x}{\varepsilon ^{p}}$$ be the inner variable. We express the original ODE using this new variable and determine $$p$$.  Since $$\frac{dy}{dx}=\frac{dy}{d\xi }\frac{d\xi }{dx}$$ then $$\frac{dy}{dx}=\frac{dy}{d\xi }\varepsilon ^{-p}$$. Hence $$\frac{d}{dx}\equiv \varepsilon ^{-p}\frac{d}{d\xi }$$\begin{align*} \frac{d^{2}}{dx^{2}} & =\frac{d}{dx}\frac{d}{dx}\\ & =\left ( \varepsilon ^{-p}\frac{d}{d\xi }\right ) \left ( \varepsilon ^{-p}\frac{d}{d\xi }\right ) \\ & =\varepsilon ^{-2p}\frac{d^{2}}{d\xi ^{2}} \end{align*}

Therefore $$\frac{d^{2}y}{dx^{2}}=\varepsilon ^{-2p}\frac{d^{2}y}{d\xi ^{2}}$$ and $$\varepsilon y^{\prime \prime }+\left ( 1+x^{2}\right ) y^{\prime }-x^{3}y\left ( x\right ) =0$$ becomes\begin{align*} \varepsilon \varepsilon ^{-2p}\frac{d^{2}y}{d\xi ^{2}}+\left ( 1+\left ( \xi \varepsilon ^{p}\right ) ^{2}\right ) \varepsilon ^{-p}\frac{dy}{d\xi }-\left ( \xi \varepsilon ^{p}\right ) ^{3}y & =0\\ \varepsilon ^{1-2p}\frac{d^{2}y}{d\xi ^{2}}+\left ( 1+\xi ^{2}\varepsilon ^{2p}\right ) \varepsilon ^{-p}\frac{dy}{d\xi }-\xi ^{3}\varepsilon ^{3p}y & =0 \end{align*}

The largest terms are $$\left \{ \varepsilon ^{1-2p},\varepsilon ^{-p}\right \}$$, therefore matching them gives $$1-2p=-p$$ or $$p=1$$. The ODE now becomes$$\varepsilon ^{-1}\frac{d^{2}y}{d\xi ^{2}}+\left ( 1+\xi ^{2}\varepsilon ^{2}\right ) \varepsilon ^{-1}\frac{dy}{d\xi }-\xi ^{3}\varepsilon ^{3}y=0 \tag{2}$$ Assuming that$y_{in}\left ( x\right ) =\sum _{n=0}^{\infty }\varepsilon ^{n}y_{n}=y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots$ And substituting the above into (2) gives$$\varepsilon ^{-1}\left ( y_{0}^{\prime \prime }+\varepsilon y_{1}^{\prime \prime }+\cdots \right ) +\left ( 1+\xi ^{2}\varepsilon ^{2}\right ) \varepsilon ^{-1}\left ( y_{0}^{\prime }+\varepsilon y_{1}^{\prime }+\cdots \right ) -\xi ^{3}\varepsilon ^{3}\left ( y_{0}+\varepsilon y_{1}+\cdots \right ) =0 \tag{2A}$$ Collecting terms in $$O\left ( \varepsilon ^{-1}\right )$$ gives the ODE$y_{0}^{\prime \prime }\left ( \xi \right ) \thicksim -y_{0}^{\prime }\left ( \xi \right )$ The solution to this ODE is$$y_{0}^{in}\left ( \xi \right ) \thicksim c_{1}+c_{2}e^{-\xi } \tag{3}$$ Applying $$y_{0}^{in}\left ( 0\right ) =1$$ gives\begin{align*} 1 & =c_{1}+c_{2}\\ c_{1} & =1-c_{2} \end{align*}

Hence (3) becomes\begin{align} y_{0}^{in}\left ( \xi \right ) & \thicksim \left ( 1-c_{2}\right ) +c_{2}e^{-\xi }\nonumber \\ & \thicksim 1+c_{2}\left ( e^{-\xi }-1\right ) \tag{4} \end{align}

Now that we found $$y_{out}$$ and $$y_{in}$$, we apply matching to ﬁnd $$c_{2}$$ in the $$y_{in}$$ solution.\begin{align*} \lim _{\xi \rightarrow \infty }y_{0}^{in}\left ( \xi \right ) & \thicksim \lim _{x\rightarrow 0^{+}}y_{0}^{out}\left ( x\right ) \\ \lim _{\xi \rightarrow \infty }1+c_{2}\left ( e^{-\xi }-1\right ) & \thicksim \lim _{x\rightarrow 0^{+}}\sqrt{2}\frac{e^{\frac{x^{2}-1}{2}}}{\sqrt{1+x^{2}}}\\ 1-c_{2} & \thicksim \sqrt{\frac{2}{e}}\lim _{x\rightarrow 0^{+}}\frac{e^{\frac{x^{2}}{2}}}{\sqrt{1+x^{2}}}\\ & \thicksim \sqrt{\frac{2}{e}}\lim _{x\rightarrow 0^{+}}\frac{e^{\frac{x^{2}}{2}}}{\sqrt{1+x^{2}}}\\ & =\sqrt{\frac{2}{e}} \end{align*}

Hence $c_{2}=1-\sqrt{\frac{2}{e}}$ Therefore  the $$y_{0}^{in}\left ( \xi \right )$$ becomes\begin{align*} y_{0}^{in}\left ( \xi \right ) & \thicksim 1+\left ( 1-\sqrt{\frac{2}{e}}\right ) \left ( e^{-\xi }-1\right ) \\ & \thicksim 1+\left ( e^{-\xi }-1\right ) -\sqrt{\frac{2}{e}}\left ( e^{-\xi }-1\right ) \\ & \thicksim e^{-\xi }-\sqrt{\frac{2}{e}}\left ( e^{-\xi }-1\right ) \\ & \thicksim e^{-\xi }-\sqrt{\frac{2}{e}}e^{-\xi }+\sqrt{\frac{2}{e}}\\ & \thicksim e^{-\xi }\left ( 1-\sqrt{\frac{2}{e}}\right ) +\sqrt{\frac{2}{e}}\\ & \thicksim 0.858+0.142e^{-\xi } \end{align*}

Therefore, the uniform solution is$$y_{uniform}\thicksim y_{in}\left ( x\right ) +y_{out}\left ( x\right ) -y_{match}+O\left ( \varepsilon \right ) \tag{4}$$ Where $$y_{match}$$ is $$y_{in}\left ( x\right )$$ at the boundary layer matching location. (or $$y_{out}$$ at same matching location).  Hence \begin{align*} y_{match} & \thicksim 1-c_{2}\\ & \thicksim 1-\left ( 1-\sqrt{\frac{2}{e}}\right ) \\ & \thicksim \sqrt{\frac{2}{e}} \end{align*}

Hence (4) becomes\begin{align*} y_{uniform} & \thicksim \overset{y_{in}}{\overbrace{e^{-\xi }\left ( 1-\sqrt{\frac{2}{e}}\right ) +\sqrt{\frac{2}{e}}}}+\overset{y_{out}}{\overbrace{\sqrt{2}\frac{e^{\frac{x^{2}-1}{2}}}{\sqrt{1+x^{2}}}}}-\overset{y_{match}}{\overbrace{\sqrt{\frac{2}{e}}}}\\ & \thicksim e^{-\frac{x}{\varepsilon }}\left ( 1-\sqrt{\frac{2}{e}}\right ) +\sqrt{2}\frac{e^{\frac{x^{2}-1}{2}}}{\sqrt{1+x^{2}}}+O\left ( \varepsilon \right ) \end{align*}

This is the leading order uniform asymptotic approximation solution. To verify the result, the numerical solution was plotted against the above solution for $$\varepsilon =\left \{ 0.1,0.05,0.01\right \}$$. We see from these plots that as $$\varepsilon$$ becomes smaller, the asymptotic solution becomes more accurate when compared to the numerical solution. This is because the error, which is $$O\left ( \varepsilon \right ) ,$$ becomes smaller. The code used to generate these plots is

The following are the three plots for each value of $$\varepsilon$$

To see the eﬀect on changing $$\varepsilon$$ on only the asymptotic approximation, the following plot gives the approximation solution only as $$\varepsilon$$ changes. We see how the approximation converges to the numerical solution as $$\varepsilon$$ becomes smaller.

#### 3.3.3 problem 9.6

3.3.3.1 Part a
3.3.3.2 Part b
3.3.3.3 Part c
3.3.3.4 Part (d)

Problem Consider initial value problem $y^{\prime }=\left ( 1+\frac{x^{-2}}{100}\right ) y^{2}-2y+1$ With $$y\left ( 1\right ) =1$$ on the interval $$0\leq x\leq 1$$.  (a) Formulate this problem as perturbation problem by introducing a small parameter $$\varepsilon$$. (b) Find outer approximation correct to order $$\varepsilon$$ with errors of order $$\varepsilon ^{2}$$. Where does this approximation break down?  (c) Introduce inner variable and ﬁnd the inner solution valid to order $$1$$ (with errors of order $$\varepsilon$$). By matching to the outer solution ﬁnd a uniform valid solution to $$y\left ( x\right )$$ on interval $$0\leq x\leq 1$$. Estimate the accuracy of this approximation. (d) Find inner solution correct to order $$\varepsilon$$ (with errors of order $$\varepsilon ^{2}$$) and show that it matches to the outer solution correct to order $$\varepsilon$$.

solution

##### 3.3.3.1 Part a

Since $$\frac{1}{100}$$ is relatively small compared to all other coeﬃcients, we replace it with $$\varepsilon$$ and the ODE becomes$$y^{\prime }-\left ( 1+\frac{\varepsilon }{x^{2}}\right ) y^{2}+2y=1 \tag{1}$$

##### 3.3.3.2 Part b

Assuming boundary layer is on the left side at $$x=0$$. We now solve for $$y_{out}\left ( x\right )$$, which is the solution near $$x=1$$.$y_{out}\left ( x\right ) =\sum _{n=0}^{\infty }\varepsilon ^{n}y_{n}=y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots$ Substituting this into (1) gives$$\left ( y_{0}^{\prime }+\varepsilon y_{1}^{\prime }+\varepsilon ^{2}y_{2}^{\prime }+\cdots \right ) -\left ( 1+\frac{\varepsilon }{x^{2}}\right ) \left ( y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots \right ) ^{2}+2\left ( y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots \right ) =1\nonumber$$ Expanding the above to see more clearly the terms gives$$\left ( y_{0}^{\prime }+\varepsilon y_{1}^{\prime }+\varepsilon ^{2}y_{2}^{\prime }+\cdots \right ) -\left ( 1+\frac{\varepsilon }{x^{2}}\right ) \left ( y_{0}^{2}+\varepsilon \left ( 2y_{0}y_{1}\right ) +\varepsilon ^{2}\left ( 2y_{0}y_{2}+y_{1}^{2}\right ) +\cdots \right ) +2\left ( y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots \right ) =1 \tag{2}$$ The leading order are those terms of coeﬃcient $$O\left ( 1\right )$$. This gives

$y_{0}^{\prime }-y_{0}^{2}+2y_{0}\thicksim 1$ With boundary conditions $$y\left ( 1\right ) =1$$.$\frac{dy_{0}}{dx}\thicksim y_{0}^{2}-2y_{0}+1$ This is separable\begin{align*} \frac{dy_{0}}{y_{0}^{2}-2y_{0}+1} & \thicksim dx\\ \frac{dy_{0}}{\left ( y_{0}-1\right ) ^{2}} & \thicksim dx \end{align*}

For $$y_{0}\neq 1$$. Integrating\begin{align} \int \frac{dy_{0}}{\left ( y_{0}-1\right ) ^{2}} & \thicksim \int dx\nonumber \\ \frac{-1}{y_{0}-1} & \thicksim x+C\nonumber \\ \left ( y_{0}-1\right ) \left ( x+C\right ) & \thicksim -1\nonumber \\ y_{0} & \thicksim \frac{-1}{x+C}+1 \tag{3} \end{align}

To ﬁnd $$C,$$ from $$y\left ( 1\right ) =1$$, we ﬁnd\begin{align*} 1 & \thicksim \frac{-1}{1+C}+1\\ 1 & \thicksim \frac{C}{1+C} \end{align*}

This is only possible if $$C=\infty$$. Therefore from (2), we conclude that $\fbox{y_0\left ( x\right ) \thicksim 1}$ The above is leading order for the outer solution. Now we repeat everything to ﬁnd $$y_{1}^{out}\left ( x\right )$$. From (2) above, we now keep all terms with $$O\left ( \varepsilon \right )$$ which gives$y_{1}^{\prime }-2y_{0}y_{1}+2y_{1}\thicksim \frac{1}{x^{2}}y_{0}^{2}$ But we found $$y_{0}\left ( x\right ) \thicksim 1$$ from above, so the above ODE becomes\begin{align*} y_{1}^{\prime }-2y_{1}+2y_{1} & \thicksim \frac{1}{x^{2}}\\ y_{1}^{\prime } & \thicksim \frac{1}{x^{2}} \end{align*}

Integrating gives$y_{1}\left ( x\right ) \thicksim -\frac{1}{x}+C$ The boundary condition now becomes $$y_{1}\left ( 1\right ) =0$$ (since we used $$y\left ( 1\right ) =1$$ earlier with $$y_{0}$$). This gives\begin{align*} 0 & =-\frac{1}{1}+C\\ C & =1 \end{align*}

Therefore the solution becomes$\fbox{y_1\left ( x\right ) \thicksim 1-\frac{1}{x}}$ Therefore, the outer solution is$y_{out}\left ( x\right ) \thicksim y_{0}+\varepsilon y_{1}$ Or$\fbox{y\left ( x\right ) \thicksim 1+\varepsilon \left ( 1-\frac{1}{x}\right ) +O\left ( \varepsilon ^2\right ) }$ Since the ODE is $$y^{\prime }-\left ( 1+\frac{\varepsilon }{x^{2}}\right ) y^{2}+2y=1$$, the approximation breaks down when $$x<\sqrt{\varepsilon }$$ or $$x<\frac{1}{10}$$. Because when $$x<\sqrt{\varepsilon }$$, the $$\frac{\varepsilon }{x^{2}}$$ will start to become large. The term $$\frac{\varepsilon }{x^{2}}$$ should remain small for the approximation to be accurate. The following are plots of the $$y_{0}$$ and $$y_{0}+\varepsilon y_{1}$$ solutions (using $$\varepsilon =\frac{1}{100})$$ showing that with two terms the approximation has improved for the outer layer, compared to the full solution of the original ODE obtained using CAS. But the outer solution breaks down near $$x=0.1$$ and smaller as can be seen in these plots. Here is the solution of the original ODE obtained using CAS

In the following plot, the $$y_{0}$$ and the $$y_{0}+\varepsilon y_{1}$$ solutions are superimposed on same ﬁgure, to show how the outer solution has improved when adding another term. But we also notice that the outer solution $$y_{0}+\varepsilon y_{1}$$ only gives good approximation to the exact solution for about $$x>0.1$$ and it breaks down quickly as $$x$$ becomes smaller.

##### 3.3.3.3 Part c

Now we will obtain solution inside the boundary layer $$y_{in}\left ( \xi \right ) =y_{0}^{in}\left ( \xi \right ) +O\left ( \varepsilon \right )$$. The ﬁrst step is to always introduce new inner variable. Since the boundary layer is on the right side, then $\xi =\frac{x}{\varepsilon ^{p}}$ And then to express the original ODE using this new variable. We also need to determine $$p$$ in the above expression.  Since the original ODE is $$y^{\prime }-\left ( 1+\varepsilon x^{-2}\right ) y^{2}+2y=1$$, then $$\frac{dy}{dx}=\frac{dy}{d\xi }\frac{d\xi }{dx}=\frac{dy}{d\xi }\left ( \varepsilon ^{-p}\right )$$, then the ODE now becomes\begin{align*} \frac{dy}{d\xi }\varepsilon ^{-p}-\left ( 1+\frac{\varepsilon }{\xi \varepsilon ^{p2}}\right ) y^{2}+2y & =1\\ \frac{dy}{d\xi }\varepsilon ^{-p}-\left ( 1+\frac{\varepsilon ^{1-2p}}{\xi ^{2}}\right ) y^{2}+2y & =1 \end{align*}

Where in the above $$y\equiv y\left ( \xi \right )$$. We see that we have $$\left \{ \varepsilon ^{-p},\varepsilon ^{\left ( 1-2p\right ) }\right \}$$ as the two biggest terms to match. This means $$-p=1-2p$$ or $p=1$ Hence the above ODE becomes$\frac{dy}{d\xi }\varepsilon ^{-1}-\left ( 1+\frac{\varepsilon ^{-1}}{\xi ^{2}}\right ) y^{2}+2y=1$ We are now ready to replace $$y\left ( \xi \right )$$ with $$\sum _{n=0}^{\infty }\varepsilon ^{n}y_{n}$$ which gives \begin{align} \left ( y_{0}^{\prime }+\varepsilon y_{1}^{\prime }+\varepsilon ^{2}y_{2}^{\prime }+\cdots \right ) \varepsilon ^{-1}-\left ( 1+\frac{\varepsilon ^{-1}}{\xi ^{2}}\right ) \left ( y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots \right ) ^{2}+2\left ( y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots \right ) & =1\nonumber \\ \left ( y_{0}^{\prime }+\varepsilon y_{1}^{\prime }+\varepsilon ^{2}y_{2}^{\prime }+\cdots \right ) \varepsilon ^{-1}-\left ( 1+\frac{\varepsilon ^{-1}}{\xi ^{2}}\right ) \left ( y_{0}^{2}+\varepsilon \left ( 2y_{0}y_{1}\right ) +\cdots \right ) +2\left ( y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots \right ) & =1\tag{3} \end{align}

Collecting terms with $$O\left ( \varepsilon ^{-1}\right )$$ gives$y_{0}^{\prime }\thicksim \frac{1}{\xi ^{2}}y_{0}^{2}$ This is separable\begin{align*} \int \frac{dy_{0}}{y_{0}^{2}} & \thicksim \int \frac{1}{\xi ^{2}}d\xi \\ -y_{0}^{-1} & \thicksim -\xi ^{-1}+C\\ \frac{1}{y_{0}} & \thicksim \frac{1}{\xi }-C\\ \frac{1}{y_{0}} & \thicksim \frac{1-C\xi }{\xi }\\ y_{0}^{in} & \thicksim \frac{\xi }{1-\xi C} \end{align*}

Now we use matching with $$y_{out}$$ to ﬁnd $$C$$. We have found before that $$y_{0}^{out}\left ( x\right ) \thicksim 1$$ therefore\begin{align*} \lim _{\xi \rightarrow \infty }y_{0}^{in}\left ( \xi \right ) +O\left ( \varepsilon \right ) & =\lim _{x\rightarrow 0}y_{0}^{out}\left ( x\right ) +O\left ( \varepsilon \right ) \\ \lim _{\xi \rightarrow \infty }\frac{\xi }{1-\xi C} & =1+O\left ( \varepsilon \right ) \\ \lim _{\xi \rightarrow \infty }\left ( -C\right ) +O\left ( \xi ^{-1}\right ) +O\left ( \varepsilon \right ) & =1+O\left ( \varepsilon \right ) \\ -C & =1 \end{align*}

Therefore $$y_{0}^{in}\left ( \xi \right ) \thicksim \frac{\xi }{1+\xi }\tag{4}$$ Therefore, \begin{align*} y_{uniform} & =y_{0}^{in}+y_{0}^{out}-y_{match}\\ & =\overset{y_{in}}{\overbrace{\frac{\xi }{1+\xi }}}+\overset{y_{out}}{\overbrace{1}}-1 \end{align*}

Since $$y_{match}=1$$ (this is what $$\lim _{\xi \rightarrow \infty }y_{0}^{in}$$ is). Writing everything in $$x$$, using $$\xi =\frac{x}{\varepsilon }$$ the above becomes\begin{align*} y_{\text{uniform}} & =\frac{\frac{x}{\varepsilon }}{1+\frac{x}{\varepsilon }}\\ & =\frac{x}{\varepsilon +x} \end{align*}

The following is a plot of the above, using $$\varepsilon =\frac{1}{100}$$ to compare with the exact solution.,

##### 3.3.3.4 Part (d)

Now we will obtain $$y_{1}^{in}$$ solution inside the boundary layer. Using (3) we found in part (c), reproduced here $$\left ( y_{0}^{\prime }+\varepsilon y_{1}^{\prime }+\varepsilon ^{2}y_{2}^{\prime }+\cdots \right ) \varepsilon ^{-1}-\left ( 1+\frac{\varepsilon ^{-1}}{\xi ^{2}}\right ) \left ( y_{0}^{2}+\varepsilon \left ( 2y_{0}y_{1}\right ) +\cdots \right ) +2\left ( y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots \right ) =1 \tag{3}$$ But now collecting all terms of order of $$O\left ( 1\right )$$, this results in$y_{1}^{\prime }-y_{0}^{2}-\frac{2}{\xi ^{2}}y_{0}y_{1}+2y_{0}\thicksim 1$ Using $$y_{0}^{in}$$ found in part (c) into the above gives\begin{align*} y_{1}^{\prime }-\frac{2}{\xi }\left ( \frac{1}{1+\xi }\right ) y_{1} & \thicksim 1-2\left ( \frac{\xi }{1+\xi }\right ) +\left ( \frac{\xi }{1+\xi }\right ) ^{2}\\ y_{1}^{\prime }-\left ( \frac{2}{\xi \left ( 1+\xi \right ) }\right ) y_{1} & \thicksim \frac{1}{\left ( \xi +1\right ) ^{2}} \end{align*}

This can be solved using integrating factor $$\mu =e^{\int \frac{-2}{\xi +\xi ^{2}}d\xi }$$ using partial fractions gives $$\mu =\exp \left ( -2\ln \xi +2\ln \left ( 1+\xi \right ) \right )$$ or $$\mu =\frac{1}{\xi ^{2}}\left ( 1+\xi \right ) ^{2}$$. Hence we obtain\begin{align*} \frac{d}{dx}\left ( \mu y_{1}\right ) & \thicksim \mu \frac{1}{\left ( \xi +1\right ) ^{2}}\\ \frac{d}{dx}\left ( \frac{1}{\xi ^{2}}\left ( 1+\xi \right ) ^{2}y_{1}\right ) & \thicksim \frac{1}{\xi ^{2}} \end{align*}

Integrating\begin{align*} \frac{1}{\xi ^{2}}\left ( 1+\xi \right ) ^{2}y_{1} & \thicksim \int \frac{1}{\xi ^{2}}d\xi \\ \frac{1}{\xi ^{2}}\left ( 1+\xi \right ) ^{2}y_{1} & \thicksim \frac{-1}{\xi }+C_{2}\\ \left ( 1+\xi \right ) ^{2}y_{1} & \thicksim -\xi +\xi ^{2}C_{2}\\ y_{1} & \thicksim \frac{-\xi +\xi ^{2}C_{2}}{\left ( 1+\xi \right ) ^{2}} \end{align*}

Therefore, the inner solution becomes\begin{align*} y^{in}\left ( \xi \right ) & =y_{0}+\varepsilon y_{1}\\ & =\frac{\xi }{1+\xi C_{1}}+\varepsilon \frac{\xi ^{2}C_{2}-\xi }{\left ( 1+\xi \right ) ^{2}} \end{align*}

To ﬁnd $$C_{1},C_{2}$$ we do matching with with $$y^{out}$$ that we found in part (a) which is $$y_{out}\left ( x\right ) \thicksim 1+\varepsilon \left ( 1-\frac{1}{x}\right )$$ $\lim _{\xi \rightarrow \infty }\left ( \frac{\xi }{1+\xi C_{1}}+\varepsilon \frac{\xi ^{2}C_{2}-\xi }{\left ( 1+\xi \right ) ^{2}}\right ) \thicksim \lim _{x\rightarrow 0}1+\varepsilon \left ( 1-\frac{1}{x}\right )$ Doing long division $$\frac{\xi }{1+\xi C_{1}}=\frac{1}{C_{1}}-\frac{1}{\xi C_{1}^{2}}+\frac{1}{\xi ^{2}C_{1}^{3}}+\cdots$$ and $$\frac{\xi ^{2}C_{2}-\xi }{\left ( 1+\xi \right ) ^{2}}=C_{2}-\frac{2C_{2}+1}{\xi }-\cdots$$, hence the above becomes\begin{align*} \lim _{\xi \rightarrow \infty }\left ( \left ( \frac{1}{C_{1}}-\frac{1}{\xi C_{1}^{2}}+\frac{1}{\xi ^{2}C_{1}^{3}}+\cdots \right ) +\left ( \varepsilon C_{2}-\varepsilon \frac{2C_{2}+1}{\xi }+\cdots \right ) \right ) & \thicksim \lim _{x\rightarrow 0}1+\varepsilon \left ( 1-\frac{1}{x}\right ) \\ \frac{1}{C_{1}}+\varepsilon C_{2} & \thicksim \lim _{x\rightarrow 0}1+\varepsilon \left ( 1-\frac{1}{x}\right ) \end{align*}

Using $$x=\xi \varepsilon$$ on the RHS, the above simpliﬁes to\begin{align*} \frac{1}{C_{1}}+\varepsilon C_{2} & \thicksim \lim _{\xi \rightarrow \infty }1+\varepsilon \left ( 1-\frac{1}{\xi \varepsilon }\right ) \\ & \thicksim \lim _{\xi \rightarrow \infty }1+\left ( \varepsilon -\frac{1}{\xi }\right ) \\ & \thicksim 1+\varepsilon \end{align*}

Therefore, $$C_{1}=1$$ and $$C_{2}=1$$. Hence the inner solution is \begin{align*} y^{in}\left ( \xi \right ) & =y_{0}+\varepsilon y_{1}\\ & =\frac{\xi }{1+\xi }+\varepsilon \frac{\xi ^{2}-\xi }{\left ( 1+\xi \right ) ^{2}} \end{align*}

Therefore \begin{align*} y_{\text{uniform}} & =y_{in}+y_{out}-y_{match}\\ & =\overset{y_{in}}{\overbrace{\frac{\xi }{1+\xi }+\varepsilon \frac{\xi ^{2}-\xi }{\left ( 1+\xi \right ) ^{2}}}}+\overset{y_{out}}{\overbrace{1+\varepsilon \left ( 1-\frac{1}{x}\right ) }}-\left ( 1+\varepsilon \right ) \end{align*}

Writing everything in $$x$$, using $$\xi =\frac{x}{\varepsilon }$$ the above becomes\begin{align*} y_{\text{uniform}} & =\frac{\frac{x}{\varepsilon }}{1+\frac{x}{\varepsilon }}+\varepsilon \frac{\frac{x^{2}}{\varepsilon ^{2}}-\frac{x}{\varepsilon }}{\left ( 1+\frac{x}{\varepsilon }\right ) ^{2}}+1+\varepsilon \left ( 1-\frac{1}{x}\right ) -\left ( 1+\varepsilon \right ) \\ & =\frac{x}{\varepsilon +x}+\frac{x^{2}-x\varepsilon }{\varepsilon \left ( 1+\frac{x}{\varepsilon }\right ) ^{2}}+1+\varepsilon -\frac{\varepsilon }{x}-1-\varepsilon \\ & =\frac{x}{\varepsilon +x}+\frac{x^{2}-x\varepsilon }{\varepsilon \left ( 1+\frac{x}{\varepsilon }\right ) ^{2}}-\frac{\varepsilon }{x}+O\left ( \varepsilon ^{2}\right ) \end{align*}

The following is a plot of the above, using $$\varepsilon =\frac{1}{100}$$ to compare with the exact solution.

Let us check if $$y_{\text{uniform}}\left ( x\right )$$ satisﬁes $$y\left ( 1\right ) =1$$ or not. \begin{align*} y_{\text{uniform}}\left ( 1\right ) & =\frac{1}{\varepsilon +1}+\frac{1-\varepsilon }{\varepsilon \left ( 1+\frac{1}{\varepsilon }\right ) ^{2}}-\varepsilon +O\left ( \varepsilon ^{2}\right ) \\ & =\frac{1-\varepsilon ^{3}-3\varepsilon ^{2}+\varepsilon }{\left ( \varepsilon +1\right ) ^{2}} \end{align*}

Taking the limit $$\varepsilon \rightarrow 0$$ gives $$1$$. Therefore $$y_{\text{uniform}}\left ( x\right )$$ satisﬁes $$y\left ( 1\right ) =1$$.

#### 3.3.4 problem 9.9

problem Use boundary layer methods to ﬁnd an approximate solution to initial value problem

\begin{align} \varepsilon y^{\prime \prime }+a\left ( x\right ) y^{\prime }+b\left ( x\right ) y & =0\tag{1}\\ y\left ( 0\right ) & =1\nonumber \\ y^{\prime }\left ( 0\right ) & =1\nonumber \end{align}

And $$a>0$$. Show that leading order uniform approximation satisﬁes $$y\left ( 0\right ) =1$$ but not $$y^{\prime }\left ( 0\right ) =1$$ for arbitrary $$b.$$ Compare leading order uniform approximation with the exact solution to the problem when $$a\left ( x\right ) ,b\left ( x\right )$$ are constants.

Solution

Since $$a\left ( x\right ) >0$$ then we expect the boundary layer to be at $$x=0$$. We  start by ﬁnding $$y_{out}\left ( x\right )$$. $y_{out}\left ( x\right ) =\sum _{n=0}^{\infty }\varepsilon ^{n}y_{n}=y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots$ Substituting this into (1) gives$$\varepsilon \left ( y_{0}^{\prime \prime }+\varepsilon y_{1}^{\prime \prime }+\varepsilon ^{2}y_{2}^{\prime \prime }+\cdots \right ) +a\left ( y_{0}^{\prime }+\varepsilon y_{1}^{\prime }+\varepsilon ^{2}y_{2}^{\prime }+\cdots \right ) +b\left ( y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots \right ) =0\nonumber$$ Collecting terms with $$O\left ( 1\right )$$ results in\begin{align*} ay_{0}^{\prime } & \thicksim -by_{0}\\ \frac{dy_{0}}{dx} & \thicksim -\frac{b}{a}y_{0} \end{align*}

This is separable\begin{align*} \int \frac{dy_{0}}{y_{0}} & \thicksim -\int \frac{b\left ( x\right ) }{a\left ( x\right ) }dx\\ \ln \left \vert y_{0}\right \vert & \thicksim -\int \frac{b\left ( x\right ) }{a\left ( x\right ) }dx+C\\ y_{0} & \thicksim Ce^{-\int _{1}^{x}\frac{b\left ( s\right ) }{a\left ( s\right ) }ds} \end{align*}

Now we ﬁnd $$y_{in}.$$ First we introduce interval variable $\xi =\frac{x}{\varepsilon ^{p}}$ And transform the ODE. Since $$\frac{dy}{dx}=\frac{dy}{d\xi }\frac{d\xi }{dx}$$ then $$\frac{dy}{dx}=\frac{dy}{d\xi }\varepsilon ^{-p}$$. Hence $$\frac{d}{dx}\equiv \varepsilon ^{-p}\frac{d}{d\xi }$$\begin{align*} \frac{d^{2}}{dx^{2}} & =\frac{d}{dx}\frac{d}{dx}\\ & =\left ( \varepsilon ^{-p}\frac{d}{d\xi }\right ) \left ( \varepsilon ^{-p}\frac{d}{d\xi }\right ) \\ & =\varepsilon ^{-2p}\frac{d^{2}}{d\xi ^{2}} \end{align*}

Therefore $$\frac{d^{2}y}{dx^{2}}=\varepsilon ^{-2p}\frac{d^{2}y}{d\xi ^{2}}$$ and the ODE becomes\begin{align*} \varepsilon \varepsilon ^{-2p}\frac{d^{2}y}{d\xi ^{2}}+a\left ( \xi \right ) \frac{dy}{d\xi }\varepsilon ^{-p}+b\left ( \xi \right ) y & =0\\ \varepsilon ^{1-2p}y^{\prime \prime }+a\varepsilon ^{-p}y^{\prime }+by & =0 \end{align*}

Balancing $$1-2p$$ with $$-p$$ shows that $\fbox{p=1}$ Hence$\varepsilon ^{-1}y^{\prime \prime }+a\varepsilon ^{-1}y^{\prime }+by=0$ Substituting $$y_{in}=\sum _{n=0}^{\infty }\varepsilon ^{n}y_{n}=y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots$$ in the above gives$\varepsilon ^{-1}\left ( y_{0}^{\prime \prime }+\varepsilon y_{1}^{\prime \prime }+\varepsilon ^{2}y_{2}^{\prime \prime }+\cdots \right ) +a\varepsilon ^{-1}\left ( y_{0}^{\prime }+\varepsilon y_{1}^{\prime }+\varepsilon ^{2}y_{2}^{\prime }+\cdots \right ) +b\left ( y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots \right ) =0$ Collecting terms with order $$O\left ( \varepsilon ^{-1}\right )$$ gives$y_{0}^{\prime \prime }\thicksim -ay_{0}^{\prime }$ Assuming $$z=y_{0}^{\prime }$$ then the above becomes $$z^{\prime }\thicksim -az$$ or $$\frac{dz}{d\xi }\thicksim -az$$. This is separable. The solution is $$\frac{dz}{z}\thicksim -ad\xi$$ or \begin{align*} \ln \left \vert z\right \vert & \thicksim -\int _{0}^{\xi }a\left ( s\right ) ds+C_{1}\\ z & \thicksim C_{1}e^{-\int _{0}^{\xi }a\left ( s\right ) ds} \end{align*}

Hence \begin{align*} \frac{dy_{0}}{d\xi } & \thicksim C_{1}e^{-\int _{0}^{\xi }a\left ( s\right ) ds}\\ dy_{0} & \thicksim \left ( C_{1}e^{-\int _{0}^{\xi }a\left ( s\right ) ds}\right ) d\xi \end{align*}

Integrating again$y_{0}^{in}\thicksim \int _{0}^{\xi }\left ( C_{1}e^{-\int _{0}^{\eta }a\left ( s\right ) ds}\right ) d\eta +C_{2}$ Applying initial conditions at $$y\left ( 0\right )$$ since this is where the $$y_{in}$$ exist. Using $$y_{in}\left ( 0\right ) =1$$ then the above becomes$1=C_{2}$ Hence the solution becomes$y_{0}^{in}\thicksim \int _{0}^{\xi }\left ( C_{1}e^{-\int _{0}^{\eta }a\left ( s\right ) ds}\right ) d\eta +1$ To apply the second initial condition, which is $$y^{\prime }\left ( 0\right ) =1$$, we ﬁrst take derivative of the above  w.r.t. $$\xi$$$y_{0}^{\prime }\thicksim C_{1}e^{-\int _{0}^{\xi }a\left ( s\right ) ds}$ Applying $$y_{0}^{\prime }\left ( 0\right ) =1$$ gives$1=C_{1}$ Hence $y_{0}^{in}\thicksim 1+\int _{0}^{\xi }e^{-\int _{0}^{\eta }a\left ( s\right ) ds}d\eta$ Now to ﬁnd constant of integration for $$y^{out}$$ from earlier, we need to do matching.\begin{align*} \lim _{\xi \rightarrow \infty }y_{0}^{in} & \thicksim \lim _{x\rightarrow 0}y_{0}^{out}\\ \lim _{\xi \rightarrow \infty }1+\int _{0}^{\xi }e^{-\int _{0}^{\eta }a\left ( s\right ) ds}d\eta & \thicksim \lim _{x\rightarrow 0}Ce^{-\int _{1}^{x}\frac{b\left ( s\right ) }{a\left ( s\right ) }ds} \end{align*}

On the LHS the integral $$\int _{0}^{\xi }e^{-\int _{0}^{\eta }a\left ( s\right ) ds}d\eta$$ since $$a>0$$ and negative power on the exponential. So as $$\xi \rightarrow \infty$$ the integral value is zero. So we have now$1\thicksim \lim _{x\rightarrow 0}Ce^{-\int _{1}^{x}\frac{b\left ( s\right ) }{a\left ( s\right ) }ds}$ Let $$\lim _{x\rightarrow 0}e^{-\int _{1}^{x}\frac{b\left ( s\right ) }{a\left ( s\right ) }ds}\rightarrow E$$, where $$E$$ is the value of the deﬁnite integral $$Ce^{-\int _{1}^{0}\frac{b\left ( s\right ) }{a\left ( s\right ) }ds}$$. Another constant, which if we know $$a\left ( x\right ) ,b\left ( x\right )$$ we can evaluate. Hence the above gives the value of $$C$$ as$C=\frac{1}{E}$ The uniform solution can now be written as\begin{align} y_{\text{uniform}} & =y_{in}+y_{out}-y_{\text{match}}\nonumber \\ & =1+\int _{0}^{\xi }e^{-\int _{0}^{\eta }a\left ( s\right ) ds}d\eta +\frac{1}{E}e^{-\int _{1}^{x}\frac{b\left ( s\right ) }{a\left ( s\right ) }ds}-1\nonumber \\ & =\int _{0}^{\xi }e^{-\int _{0}^{\eta }a\left ( s\right ) ds}d\eta +\frac{1}{E}e^{-\int _{1}^{x}\frac{b\left ( s\right ) }{a\left ( s\right ) }ds} \tag{2} \end{align}

Finally, we need to show that $$y_{\text{uniform}}\left ( 0\right ) =1$$ but not $$y_{\text{uniform}}^{\prime }\left ( 0\right ) =1$$. From (2), at $$x=0\,$$ which also means $$\xi =0$$, since boundary layer at left side, equation (2) becomes$y_{\text{uniform}}\left ( 0\right ) =0+\frac{1}{E}\lim _{x\rightarrow 0}e^{-\int _{1}^{x}\frac{b\left ( s\right ) }{a\left ( s\right ) }ds}$ But we said that $$\lim _{x\rightarrow 0}e^{-\int _{1}^{x}\frac{b\left ( s\right ) }{a\left ( s\right ) }ds}=E$$, therefore $y_{\text{uniform}}\left ( 0\right ) =1$ Now we take derivative of (2) w.r.t. $$x$$ and obtain\begin{align*} y_{\text{uniform}}^{\prime }\left ( x\right ) & =\frac{d}{dx}\left ( \int _{0}^{\frac{x}{\varepsilon }}e^{-\int _{0}^{\eta }a\left ( s\right ) ds}d\eta \right ) +\frac{1}{E}\frac{d}{dx}\left ( e^{-\int _{1}^{x}\frac{b\left ( s\right ) }{a\left ( s\right ) }ds}\right ) \\ & =e^{-\int _{0}^{\frac{x}{\varepsilon }}a\left ( s\right ) ds}-\frac{1}{E}\frac{b\left ( x\right ) }{a\left ( x\right ) }e^{-\int _{1}^{x}\frac{b\left ( s\right ) }{a\left ( s\right ) }ds} \end{align*}

And at $$x=0$$ the above becomes$y_{\text{uniform}}^{\prime }\left ( 0\right ) =1-\frac{1}{E}\frac{b\left ( 0\right ) }{a\left ( 0\right ) }$ The above is zero only if $$b\left ( 0\right ) =0$$ (since we know $$a\left ( 0\right ) >0$$). Therefore, we see that $$y_{\text{uniform}}^{\prime }\left ( 0\right ) \neq 1$$ for any arbitrary $$b\left ( x\right )$$. Which is what we are asked to show.

Will now solve the whole problem again, when $$a,b$$ are constants.\begin{align} \varepsilon y^{\prime \prime }+ay^{\prime }+by & =0\tag{1A}\\ y\left ( 0\right ) & =1\nonumber \\ y^{\prime }\left ( 0\right ) & =1\nonumber \end{align}

And $$a>0$$. And compare leading order uniform approximation with the exact solution to the problem when $$a\left ( x\right ) ,b\left ( x\right )$$ are constants. Since $$a>0$$ then boundary layer will occur at $$x=0$$. We  start by ﬁnding $$y_{out}\left ( x\right )$$. $y_{out}\left ( x\right ) =\sum _{n=0}^{\infty }\varepsilon ^{n}y_{n}=y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots$ Substituting this into (1) gives$$\varepsilon \left ( y_{0}^{\prime \prime }+\varepsilon y_{1}^{\prime \prime }+\varepsilon ^{2}y_{2}^{\prime \prime }+\cdots \right ) +a\left ( y_{0}^{\prime }+\varepsilon y_{1}^{\prime }+\varepsilon ^{2}y_{2}^{\prime }+\cdots \right ) +b\left ( y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots \right ) =0\nonumber$$ Collecting terms with $$O\left ( 1\right )$$ results in\begin{align*} ay_{0}^{\prime } & \thicksim -by_{0}\\ \frac{dy_{0}}{dx} & \thicksim -\frac{b}{a}y_{0} \end{align*}

This is separable\begin{align*} \int \frac{dy_{0}}{y_{0}} & \thicksim -\frac{b}{a}dx\\ \ln \left \vert y_{0}\right \vert & \thicksim -\frac{b}{a}x+C\\ y_{0}^{out} & \thicksim C_{1}e^{-\frac{b}{a}x} \end{align*}

Now we ﬁnd $$y_{in}.$$ First we introduce internal variable $$\xi =\frac{x}{\varepsilon ^{p}}$$ and transform the ODE as we did above. This results in $\varepsilon ^{-1}\left ( y_{0}^{\prime \prime }+\varepsilon y_{1}^{\prime \prime }+\varepsilon ^{2}y_{2}^{\prime \prime }+\cdots \right ) +a\varepsilon ^{-1}\left ( y_{0}^{\prime }+\varepsilon y_{1}^{\prime }+\varepsilon ^{2}y_{2}^{\prime }+\cdots \right ) +b\left ( y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots \right ) =0$ Collecting terms with order $$O\left ( \varepsilon ^{-1}\right )$$ gives$y_{0}^{\prime \prime }\thicksim -ay_{0}^{\prime }$ Assuming $$z=y_{0}^{\prime }$$ then the above becomes $$z^{\prime }\thicksim -az$$ or $$\frac{dz}{d\xi }\thicksim -az$$. This is separable. The solution is $$\frac{dz}{z}\thicksim -ad\xi$$ or \begin{align*} \ln \left \vert z\right \vert & \thicksim -a\xi +E_{1}\\ z & \thicksim E_{1}e^{-a\xi } \end{align*}

Hence \begin{align*} \frac{dy_{0}}{d\xi } & \thicksim E_{1}e^{-a\xi }\\ dy_{0} & \thicksim E_{1}e^{-a\xi }d\xi \end{align*}

Integrating again$y_{0}^{in}\thicksim E_{1}\left ( \frac{-1}{a}\right ) e^{-a\xi }+E_{2}$ Applying initial conditions at $$y\left ( 0\right )$$ since this is where the $$y_{in}$$ exist. Using $$y_{in}\left ( 0\right ) =1$$ then the above becomes\begin{align*} 1 & =E_{1}\left ( \frac{-1}{a}\right ) +E_{2}\\ a\left ( E_{2}-1\right ) & =E_{1} \end{align*}

Hence the solution becomes$$y_{0}^{in}\thicksim \left ( 1-E_{2}\right ) e^{-a\xi }+E_{2} \tag{1B}$$

To apply the second initial condition, which is $$y^{\prime }\left ( 0\right ) =1$$, we ﬁrst take derivative of the above  w.r.t. $$\xi$$

$y_{0}^{\prime }\thicksim -a\left ( 1-E_{2}\right ) e^{-a\xi }$

Hence $$y^{\prime }\left ( 0\right ) =1$$ gives

\begin{align*} 1 & =-a\left ( 1-E_{2}\right ) \\ 1 & =-a+aE_{2}\\ E_{2} & =\frac{1+a}{a} \end{align*}

And the solution $$y_{in}$$ in (1B) becomes \begin{align*} y_{0}^{in} & \thicksim \left ( 1-\frac{1+a}{a}\right ) e^{-a\xi }+\frac{1+a}{a}\\ & \thicksim \left ( \frac{-1}{a}\right ) e^{-a\xi }+\frac{1+a}{a}\\ & \thicksim \frac{\left ( 1+a\right ) -e^{-a\xi }}{a} \end{align*}

Now to ﬁnd constant of integration for $$y^{out}\left ( x\right )$$ from earlier, we need to do matching.\begin{align*} \lim _{\xi \rightarrow \infty }y_{0}^{in} & \thicksim \lim _{x\rightarrow 0}y_{0}^{out}\\ \lim _{\xi \rightarrow \infty }\frac{\left ( 1+a\right ) -e^{-a\xi }}{a} & \thicksim \lim _{x\rightarrow 0}C_{1}e^{-\frac{b}{a}x}\\ \frac{1+a}{a} & \thicksim C_{1} \end{align*}

Hence now the uniform solution can be written as\begin{align} y_{\text{uniform}}\left ( x\right ) & \thicksim y_{in}+y_{out}-y_{\text{match}}\nonumber \\ & \thicksim \overset{\,y_{in}}{\overbrace{\frac{\left ( 1+a\right ) -e^{-a\frac{x}{\varepsilon }}}{a}}}+\overset{y_{out}}{\overbrace{\frac{1+a}{a}e^{-\frac{b}{a}x}}}-\frac{1+a}{a}\nonumber \\ & \thicksim \frac{\left ( 1+a\right ) }{a}-\frac{e^{-a\frac{x}{\varepsilon }}}{a}+\frac{1+a}{a}e^{-\frac{b}{a}x}-\frac{1+a}{a}\nonumber \\ & \thicksim -\frac{e^{-a\frac{x}{\varepsilon }}}{a}+\frac{1+a}{a}e^{-\frac{b}{a}x}\nonumber \\ & \thicksim \frac{1}{a}\left ( \left ( 1+a\right ) e^{-\frac{b}{a}x}-e^{-a\frac{x}{\varepsilon }}\right ) \tag{2A} \end{align}

Now we compare the above, which is the leading order uniform approximation, to the exact solution. Since now $$a,b$$ are constants, then the exact solution is$$y_{exact}\left ( x\right ) =Ae^{\lambda _{1}x}+Be^{\lambda _{2}x} \tag{3}$$ Where $$\lambda _{1,2}$$ are roots of characteristic equation of $$\varepsilon y^{\prime \prime }+ay^{\prime }+by=0$$. These are $$\lambda =\frac{-a}{2\varepsilon }\pm \frac{1}{2\varepsilon }\sqrt{a^{2}-4\varepsilon b}$$.  Hence\begin{align*} \lambda _{1} & =\frac{-a}{2}+\frac{1}{2}\sqrt{a^{2}-4\varepsilon b}\\ \lambda _{2} & =\frac{-a}{2}-\frac{1}{2}\sqrt{a^{2}-4\varepsilon b} \end{align*}

Applying initial conditions to (3). $$y\left ( 0\right ) =1$$ gives\begin{align*} 1 & =A+B\\ B & =1-A \end{align*}

And solution becomes $$y_{exact}\left ( x\right ) =Ae^{\lambda _{1}x}+\left ( 1-A\right ) e^{\lambda _{2}x}$$. Taking derivatives gives$y_{exact}^{\prime }\left ( x\right ) =A\lambda _{1}e^{\lambda _{1}x}+\left ( 1-A\right ) \lambda _{2}e^{\lambda _{2}x}$ Using $$y^{\prime }\left ( 0\right ) =1$$ gives\begin{align*} 1 & =A\lambda _{1}+\left ( 1-A\right ) \lambda _{2}\\ 1 & =A\left ( \lambda _{1}-\lambda _{2}\right ) +\lambda _{2}\\ A & =\frac{1-\lambda _{2}}{\lambda _{1}-\lambda _{2}} \end{align*}

Therefore, $$B=1-\frac{1-\lambda _{2}}{\lambda _{1}-\lambda _{2}}$$ and the exact solution becomes\begin{align} y_{exact}\left ( x\right ) & =\frac{1-\lambda _{2}}{\lambda _{1}-\lambda _{2}}e^{\lambda _{1}x}+\left ( 1-\frac{1-\lambda _{2}}{\lambda _{1}-\lambda _{2}}\right ) e^{\lambda _{2}x}\nonumber \\ & =\frac{1-\lambda _{2}}{\lambda _{1}-\lambda _{2}}e^{\lambda _{1}x}+\left ( \frac{\left ( \lambda _{1}-\lambda _{2}\right ) -\left ( 1-\lambda _{2}\right ) }{\lambda _{1}-\lambda _{2}}\right ) e^{\lambda _{2}x}\nonumber \\ & =\frac{1-\lambda _{2}}{\lambda _{1}-\lambda _{2}}e^{\lambda _{1}x}+\left ( \frac{\lambda _{1}-1}{\lambda _{1}-\lambda _{2}}\right ) e^{\lambda _{2}x} \tag{4} \end{align}

While the uniform solution above was found to be $$\frac{1}{a}\left ( \left ( 1+a\right ) e^{-\frac{b}{a}x}-e^{-a\frac{x}{\varepsilon }}\right )$$.  Here is a plot of the exact solution above, for $$\varepsilon =\left \{ 1/10,1/50,1/100\right \} ,$$ and for some values for $$a,b$$ such as $$a=1,b=10$$ in order to compare with the uniform solution. Note that the uniform solution is $$O\left ( \varepsilon \right )$$. As $$\varepsilon$$ becomes smaller, the leading order uniform solution will better approximate the exact solution. At $$\varepsilon =0.01$$ the uniform approximation gives very good approximation. This is using only leading term approximation.

#### 3.3.5 problem 9.15(b)

Problem Find ﬁrst order uniform approximation valid as $$\varepsilon \rightarrow 0^{+}$$ for $$0\leq x\leq 1$$\begin{align} \varepsilon y^{\prime \prime }+\left ( x^{2}+1\right ) y^{\prime }-x^{3}y & =0\tag{1}\\ y\left ( 0\right ) & =1\nonumber \\ y\left ( 1\right ) & =1\nonumber \end{align}

Solution

Since $$a\left ( x\right ) =\left ( x^{2}+1\right ) \,$$ is positive for $$0\leq x\leq 1$$, therefore we expect the boundary layer to be on the left side at $$x=0$$.  Assuming this is the case for now (if it is not, then we expect not to be able to do the matching). We  start by ﬁnding $$y_{out}\left ( x\right )$$. $y_{out}\left ( x\right ) =\sum _{n=0}^{\infty }\varepsilon ^{n}y_{n}=y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots$ Substituting this into (1) gives$$\varepsilon \left ( y_{0}^{\prime \prime }+\varepsilon y_{1}^{\prime \prime }+\varepsilon ^{2}y_{2}^{\prime \prime }+\cdots \right ) +\left ( x^{2}+1\right ) \left ( y_{0}^{\prime }+\varepsilon y_{1}^{\prime }+\varepsilon ^{2}y_{2}^{\prime }+\cdots \right ) -x^{3}\left ( y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots \right ) =0 \tag{2}$$ Collecting terms with $$O\left ( 1\right )$$ results in\begin{align*} \left ( x^{2}+1\right ) y_{0}^{\prime } & \thicksim x^{3}y_{0}\\ \frac{dy_{0}}{dx} & \thicksim \frac{x^{3}}{\left ( x^{2}+1\right ) }y_{0} \end{align*}

This is separable.\begin{align*} \int \frac{dy_{0}}{y_{0}} & \thicksim \int \frac{x^{3}}{\left ( x^{2}+1\right ) }dx\\ \ln \left \vert y_{0}\right \vert & \thicksim \int x-\frac{x}{1+x^{2}}dx\\ & \thicksim \frac{x^{2}}{2}-\frac{1}{2}\ln \left ( 1+x^{2}\right ) +C \end{align*}

Hence\begin{align*} y_{0} & \thicksim e^{\frac{x^{2}}{2}-\frac{1}{2}\ln \left ( 1+x^{2}\right ) +C}\\ & \thicksim \frac{Ce^{\frac{x^{2}}{2}}}{\sqrt{1+x^{2}}} \end{align*}

Applying $$y_{0}^{out}\left ( 1\right ) =1$$ to the above (since this is where the outer solution is), we solve for $$C$$\begin{align*} 1 & \thicksim \frac{Ce^{\frac{1}{2}}}{\sqrt{2}}\\ C & \thicksim \sqrt{2}e^{\frac{-1}{2}} \end{align*}

Therefore\begin{align*} y_{0}^{out} & \thicksim \frac{\sqrt{2}e^{\frac{-1}{2}}e^{\frac{x^{2}}{2}}}{\sqrt{1+x^{2}}}\\ & \thicksim \sqrt{\frac{2}{e}}\frac{e^{\frac{x^{2}}{2}}}{\sqrt{1+x^{2}}} \end{align*}

Now we need to ﬁnd $$y_{1}^{out}$$.  From (2), but now collecting terms in $$O\left ( \varepsilon \right )$$ gives$$y_{0}^{\prime \prime }+\left ( x^{2}+1\right ) y_{1}^{\prime }\backsim x^{3}y_{1} \tag{3}$$ In the above $$y_{0}^{\prime \prime }$$ is known.\begin{align*} y_{0}^{\prime }\left ( x\right ) & =\sqrt{\frac{2}{e}}\frac{d}{dx}\left ( \frac{e^{\frac{x^{2}}{2}}}{\sqrt{1+x^{2}}}\right ) \\ & =\sqrt{\frac{2}{e}}\frac{x^{3}e^{\frac{x^{2}}{2}}}{\left ( 1+x^{2}\right ) ^{\frac{3}{2}}} \end{align*}

And$y_{0}^{\prime \prime }\left ( x\right ) =\sqrt{\frac{2}{e}}\frac{x^{2}e^{\frac{x^{2}}{2}}\left ( x^{4}+x^{2}+3\right ) }{\left ( 1+x^{2}\right ) ^{\frac{5}{2}}}$ Hence (3) becomes\begin{align*} \left ( x^{2}+1\right ) y_{1}^{\prime } & \backsim x^{3}y_{1}-y_{0}^{\prime \prime }\\ \left ( x^{2}+1\right ) y_{1}^{\prime } & \backsim x^{3}y_{1}-\sqrt{\frac{2}{e}}\frac{x^{2}e^{\frac{x^{2}}{2}}\left ( x^{4}+x^{2}+3\right ) }{\left ( 1+x^{2}\right ) ^{\frac{5}{2}}}\\ y_{1}^{\prime }-\frac{x^{3}}{\left ( x^{2}+1\right ) }y_{1} & \backsim -\sqrt{\frac{2}{e}}\frac{x^{2}e^{\frac{x^{2}}{2}}\left ( x^{4}+x^{2}+3\right ) }{\left ( 1+x^{2}\right ) ^{\frac{7}{2}}} \end{align*}

Integrating factor is $$\mu =e^{-\int \frac{x^{3}}{\left ( x^{2}+1\right ) }dx}=e^{-\frac{x^{2}}{2}+\frac{1}{2}\ln \left ( 1+x^{2}\right ) }=\left ( 1+x^{2}\right ) ^{\frac{1}{2}}e^{\frac{-x^{2}}{2}}$$, hence the above becomes\begin{align*} \frac{d}{dx}\left ( \left ( 1+x^{2}\right ) ^{\frac{1}{2}}e^{\frac{-x^{2}}{2}}y_{1}\right ) & \backsim -\sqrt{\frac{2}{e}}\left ( 1+x^{2}\right ) ^{\frac{1}{2}}e^{\frac{-x^{2}}{2}}\frac{x^{2}e^{\frac{x^{2}}{2}}\left ( x^{4}+x^{2}+3\right ) }{\left ( 1+x^{2}\right ) ^{\frac{7}{2}}}\\ & \backsim -\sqrt{\frac{2}{e}}\frac{x^{2}\left ( x^{4}+x^{2}+3\right ) }{\left ( 1+x^{2}\right ) ^{3}} \end{align*}

Integrating gives (with help from CAS)\begin{align*} \left ( 1+x^{2}\right ) ^{\frac{1}{2}}e^{\frac{-x^{2}}{2}}y_{1}\left ( x\right ) & \backsim -\sqrt{\frac{2}{e}}\int \frac{x^{2}\left ( x^{4}+x^{2}+3\right ) }{\left ( 1+x^{2}\right ) ^{3}}dx\\ & \backsim -\sqrt{\frac{2}{e}}\int 1-\frac{3}{\left ( 1+x^{2}\right ) ^{3}}+\frac{4}{\left ( 1+x^{2}\right ) ^{2}}-\frac{2}{1+x^{2}}dx\\ & \backsim -\sqrt{\frac{2}{e}}\left ( x-\frac{3x}{4\left ( 1+x^{2}\right ) ^{2}}+\frac{7x}{8\left ( 1+x^{2}\right ) }-9\frac{\arctan \left ( x\right ) }{8}\right ) +C_{1} \end{align*}

Hence$y_{1}^{out}\left ( x\right ) \backsim -\sqrt{\frac{2}{e}}\frac{e^{\frac{x^{2}}{2}}}{\left ( 1+x^{2}\right ) ^{\frac{1}{2}}}\left ( x-\frac{3x}{4\left ( 1+x^{2}\right ) ^{2}}+\frac{7x}{8\left ( 1+x^{2}\right ) }-9\frac{\arctan \left ( x\right ) }{8}\right ) +C_{1}\frac{e^{\frac{x^{2}}{2}}}{\left ( 1+x^{2}\right ) ^{\frac{1}{2}}}$ Now we ﬁnd $$C_{1}$$ from boundary conditions $$y_{1}\left ( 1\right ) =0$$. (notice the BC now is $$y_{1}\left ( 1\right ) =0$$ and not $$y_{1}\left ( 1\right ) =1$$, since we used $$y_{1}\left ( 1\right ) =1$$ already).\begin{align*} \sqrt{\frac{2}{e}}\frac{e^{\frac{1}{2}}}{\left ( 1+1\right ) ^{\frac{1}{2}}}\left ( 1-\frac{3}{4\left ( 1+1\right ) ^{2}}+\frac{7}{8\left ( 1+1\right ) }-9\frac{\arctan \left ( 1\right ) }{8}\right ) & =C_{1}\frac{e^{\frac{1}{2}}}{\left ( 1+1\right ) ^{\frac{1}{2}}}\\ \sqrt{\frac{2}{e}}\frac{e^{\frac{1}{2}}}{\sqrt{2}}\left ( 1-\frac{3}{16}+\frac{7}{16}-\frac{9}{8}\arctan \left ( 1\right ) \right ) & =C_{1}\frac{e^{\frac{1}{2}}}{\sqrt{2}} \end{align*}

Simplifying\begin{align*} 1-\frac{3}{16}+\frac{7}{16}-\frac{9}{8}\arctan \left ( 1\right ) & =C_{1}\frac{e^{\frac{1}{2}}}{\sqrt{2}}\\ C_{1} & =\sqrt{\frac{2}{e}}\left ( \frac{5}{4}-\frac{9}{8}\arctan \left ( 1\right ) \right ) \\ C_{1} & =\sqrt{\frac{2}{e}}\left ( \frac{5}{4}-\frac{9}{32}\pi \right ) \\ & =0.31431 \end{align*}

Hence \begin{align*} y_{1}^{out} & \thicksim -\sqrt{\frac{2}{e}}\frac{e^{\frac{x^{2}}{2}}}{\sqrt{\left ( 1+x^{2}\right ) }}\left ( x-\frac{3x}{4\left ( 1+x^{2}\right ) ^{2}}+\frac{7x}{8\left ( 1+x^{2}\right ) }-\frac{9}{8}\arctan \left ( x\right ) \right ) +\sqrt{\frac{2}{e}}\left ( \frac{5}{4}-\frac{9}{32}\pi \right ) \frac{e^{\frac{x^{2}}{2}}}{\sqrt{\left ( 1+x^{2}\right ) }}\\ & \thicksim \sqrt{\frac{2}{e}}\frac{e^{\frac{x^{2}}{2}}}{\sqrt{\left ( 1+x^{2}\right ) }}\left ( \left ( \frac{5}{4}-\frac{9}{32}\pi \right ) -\left ( x-\frac{3x}{4\left ( 1+x^{2}\right ) ^{2}}+\frac{7x}{8\left ( 1+x^{2}\right ) }-\frac{9}{8}\arctan \left ( x\right ) \right ) \right ) \\ & \thicksim \sqrt{\frac{2}{e}}\frac{e^{\frac{x^{2}}{2}}}{\sqrt{\left ( 1+x^{2}\right ) }}\left ( \frac{5}{4}-\frac{9}{32}\pi -x+\frac{3x}{4\left ( 1+x^{2}\right ) ^{2}}-\frac{7x}{8\left ( 1+x^{2}\right ) }+\frac{9}{8}\arctan \left ( x\right ) \right ) \end{align*}

Hence\begin{align} y^{out}\left ( x\right ) & \thicksim y_{0}^{out}+\varepsilon y_{1}^{out}\nonumber \\ & \thicksim \sqrt{\frac{2}{e}}\frac{e^{\frac{x^{2}}{2}}}{\sqrt{1+x^{2}}}+\varepsilon \sqrt{\frac{2}{e}}\frac{e^{\frac{x^{2}}{2}}}{\sqrt{\left ( 1+x^{2}\right ) }}\left ( \frac{5}{4}-\frac{9}{32}\pi -x+\frac{3x}{4\left ( 1+x^{2}\right ) ^{2}}-\frac{7x}{8\left ( 1+x^{2}\right ) }+\frac{9}{8}\arctan \left ( x\right ) \right ) +O\left ( \varepsilon ^{2}\right ) \nonumber \\ & \thicksim \sqrt{\frac{2}{e}}\frac{e^{\frac{x^{2}}{2}}}{\sqrt{1+x^{2}}}\left ( 1+\varepsilon \left ( \frac{5}{4}-\frac{9}{32}\pi -x+\frac{3x}{4\left ( 1+x^{2}\right ) ^{2}}-\frac{7x}{8\left ( 1+x^{2}\right ) }+\frac{9}{8}\arctan \left ( x\right ) \right ) \right ) +O\left ( \varepsilon ^{2}\right ) \tag{3A} \end{align}

Now that we found $$y^{out}\left ( x\right )$$, we need to ﬁnd $$y^{in}\left ( x\right )$$ and then do the matching and the ﬁnd uniform approximation. Since the boundary layer at $$x=0,$$ we introduce inner variable $$\xi =\frac{x}{\varepsilon ^{p}}$$ and then express the original ODE using this new variable. We also need to determine $$p$$ in the above expression.  Since $$\frac{dy}{dx}=\frac{dy}{d\xi }\frac{d\xi }{dx}$$ then $$\frac{dy}{dx}=\frac{dy}{d\xi }\varepsilon ^{-p}$$. Hence $$\frac{d}{dx}\equiv \varepsilon ^{-p}\frac{d}{d\xi }$$\begin{align*} \frac{d^{2}}{dx^{2}} & =\frac{d}{dx}\frac{d}{dx}\\ & =\left ( \varepsilon ^{-p}\frac{d}{d\xi }\right ) \left ( \varepsilon ^{-p}\frac{d}{d\xi }\right ) \\ & =\varepsilon ^{-2p}\frac{d^{2}}{d\xi ^{2}} \end{align*}

Therefore $$\frac{d^{2}y}{dx^{2}}=\varepsilon ^{-2p}\frac{d^{2}y}{d\xi ^{2}}$$ and the ODE$$\ \varepsilon y^{\prime \prime }+\left ( x^{2}+1\right ) y^{\prime }-x^{3}y=0$$ now becomes\begin{align*} \varepsilon \varepsilon ^{-2p}\frac{d^{2}y}{d\xi ^{2}}+\left ( \left ( \xi \varepsilon ^{p}\right ) ^{2}+1\right ) \varepsilon ^{-p}\frac{dy}{d\xi }-\left ( \xi \varepsilon ^{p}\right ) ^{3}y & =0\\ \varepsilon ^{1-2p}\frac{d^{2}y}{d\xi ^{2}}+\left ( \xi ^{2}\varepsilon ^{p}+\varepsilon ^{-p}\right ) \frac{dy}{d\xi }-\xi ^{3}\varepsilon ^{3p}y & =0 \end{align*}

The largest terms are $$\left \{ \varepsilon ^{1-2p},\varepsilon ^{-p}\right \}$$, therefore matching them gives $$p=1$$. The ODE now becomes$$\varepsilon ^{-1}\frac{d^{2}y}{d\xi ^{2}}+\left ( \xi ^{2}\varepsilon +\varepsilon ^{-1}\right ) \frac{dy}{d\xi }-\xi ^{3}\varepsilon ^{3}y=0 \tag{4}$$ Assuming that$y_{in}\left ( x\right ) =\sum _{n=0}^{\infty }\varepsilon ^{n}y_{n}=y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots$ And substituting the above into (4) gives$$\varepsilon ^{-1}\left ( y_{0}^{\prime \prime }+\varepsilon y_{1}^{\prime \prime }+\cdots \right ) +\left ( \xi ^{2}\varepsilon +\varepsilon ^{-1}\right ) \left ( y_{0}^{\prime }+\varepsilon y_{1}^{\prime }+\cdots \right ) -\xi ^{3}\varepsilon ^{3}\left ( y_{0}+\varepsilon y_{1}+\cdots \right ) =0 \tag{4A}$$ Collecting terms in $$O\left ( \varepsilon ^{-1}\right )$$ gives$y_{0}^{\prime \prime }\backsim -y_{0}^{\prime }$ Letting $$z=y_{0}^{\prime }$$, the above becomes\begin{align*} \frac{dz}{d\xi } & \backsim -z\\ \frac{dz}{z} & \backsim -d\xi \\ \ln \left \vert z\right \vert & \backsim -\xi +C_{1}\\ z & \backsim C_{1}e^{-\xi } \end{align*}

Hence\begin{align} \frac{dy_{0}}{d\xi } & \backsim C_{1}e^{-\xi }\nonumber \\ y_{0} & \backsim C_{1}\int e^{-\xi }d\xi +C_{2}\nonumber \\ & \backsim -C_{1}e^{-\xi }+C_{2} \tag{5} \end{align}

Applying boundary conditions $$y_{0}^{in}\left ( 0\right ) =1$$ gives\begin{align*} 1 & =-C_{1}+C_{2}\\ C_{2} & =1+C_{1} \end{align*}

And (5) becomes\begin{align} y_{0}^{in}\left ( \xi \right ) & \backsim -C_{1}e^{-\xi }+\left ( 1+C_{1}\right ) \nonumber \\ & \backsim 1+C_{1}\left ( 1-e^{-\xi }\right ) \tag{6} \end{align}

We now ﬁnd $$y_{1}^{in}$$. Going back to (4) and collecting terms in $$O\left ( 1\right )$$ gives the ODE$y_{1}^{\prime \prime }\backsim y_{1}^{\prime }$ This is the same ODE we solved above. But it will have diﬀerent B.C. Hence$y_{1}^{in}\backsim -C_{3}e^{-\xi }+C_{4}$ Applying boundary conditions $$y_{1}^{in}\left ( 0\right ) =0$$ gives\begin{align*} 0 & =-C_{3}+C_{4}\\ C_{3} & =C_{4} \end{align*}

Therefore\begin{align*} y_{1}^{in} & \backsim -C_{3}e^{-\xi }+C_{3}\\ & \backsim C_{3}\left ( 1-e^{-\xi }\right ) \end{align*}

Now we have the leading order $$y^{in}$$\begin{align} y^{in}\left ( \xi \right ) & =y_{0}^{in}+\varepsilon y_{1}^{in}\nonumber \\ & =1+C_{1}\left ( 1-e^{-\xi }\right ) +\varepsilon C_{3}\left ( 1-e^{-\xi }\right ) +O\left ( \varepsilon ^{2}\right ) \tag{7} \end{align}

Now we are ready to do the matching between (7) and (3A)\begin{multline*} \lim _{\xi \rightarrow \infty }1+C_{1}\left ( 1-e^{-\xi }\right ) +\varepsilon C_{3}\left ( 1-e^{-\xi }\right ) \thicksim \\ \lim _{x\rightarrow 0}\sqrt{\frac{2}{e}}\frac{e^{\frac{x^{2}}{2}}}{\sqrt{1+x^{2}}}\left ( 1+\varepsilon \left ( \frac{5}{4}-\frac{9}{32}\pi -x+\frac{3x}{4\left ( 1+x^{2}\right ) ^{2}}-\frac{7x}{8\left ( 1+x^{2}\right ) }+\frac{9}{8}\arctan \left ( x\right ) \right ) \right ) \end{multline*} Or$1+C_{1}+\varepsilon C_{3}\thicksim \sqrt{\frac{2}{e}}\lim _{x\rightarrow 0}\frac{e^{\frac{x^{2}}{2}}}{\sqrt{1+x^{2}}}+\sqrt{\frac{2}{e}}\varepsilon \lim _{x\rightarrow 0}\frac{e^{\frac{x^{2}}{2}}}{\sqrt{1+x^{2}}}\left ( \frac{5}{4}-\frac{9}{32}\pi -x+\frac{3x}{4\left ( 1+x^{2}\right ) ^{2}}-\frac{7x}{8\left ( 1+x^{2}\right ) }+\frac{9}{8}\arctan \left ( x\right ) \right )$ But $$\lim _{x\rightarrow 0}\frac{e^{\frac{x^{2}}{2}}}{\sqrt{1+x^{2}}}\rightarrow 1$$, $$\lim _{x\rightarrow 0}\frac{3x}{4\left ( 1+x^{2}\right ) ^{2}}\rightarrow 0$$ $$\lim _{x\rightarrow 0}\frac{7x}{8\left ( 1+x^{2}\right ) }\rightarrow 0$$ therefore the above becomes$1+C_{1}+\varepsilon C_{3}\thicksim \sqrt{\frac{2}{e}}+\sqrt{\frac{2}{e}}\varepsilon \left ( \frac{5}{4}-\frac{9}{32}\pi \right )$ Hence \begin{align*} 1+C_{1} & =\sqrt{\frac{2}{e}}\\ C_{1} & =\sqrt{\frac{2}{e}}-1\\ C_{3} & =\sqrt{\frac{2}{e}}\left ( \frac{5}{4}-\frac{9}{32}\pi \right ) \end{align*}

This means that \begin{align*} y^{in}\left ( \xi \right ) & \thicksim 1+C_{1}\left ( 1-e^{-\xi }\right ) +\varepsilon C_{3}\left ( 1-e^{-\xi }\right ) \\ & \thicksim 1+\left ( \sqrt{\frac{2}{e}}-1\right ) \left ( 1-e^{-\xi }\right ) +\varepsilon \sqrt{\frac{2}{e}}\left ( \frac{5}{4}-\frac{9}{32}\pi \right ) \left ( 1-e^{-\xi }\right ) \end{align*}

Therefore\begin{align*} y_{\text{uniform}\left ( x\right ) } & \thicksim y^{in}\left ( \xi \right ) +y^{out}\left ( x\right ) -y_{match}\\ & \thicksim 1+\left ( \sqrt{\frac{2}{e}}-1\right ) \left ( 1-e^{-\xi }\right ) +\varepsilon \sqrt{\frac{2}{e}}\left ( \frac{5}{4}-\frac{9}{32}\pi \right ) \left ( 1-e^{-\xi }\right ) \\ & +\sqrt{\frac{2}{e}}\frac{e^{\frac{x^{2}}{2}}}{\sqrt{1+x^{2}}}\left ( 1+\varepsilon \left ( \frac{5}{4}-\frac{9}{32}\pi -x+\frac{3x}{4\left ( 1+x^{2}\right ) ^{2}}-\frac{7x}{8\left ( 1+x^{2}\right ) }+\frac{9}{8}\arctan \left ( x\right ) \right ) \right ) \\ & -\left ( \sqrt{\frac{2}{e}}+\sqrt{\frac{2}{e}}\varepsilon \left ( \frac{5}{4}-\frac{9}{32}\pi \right ) \right ) \end{align*}

Or (replacing $$\xi$$ by $$\frac{x}{\varepsilon }$$ and simplifying)\begin{align*} y_{\text{uniform}\left ( x\right ) } & \thicksim 1+\left ( \sqrt{\frac{2}{e}}-1\right ) \left ( 1-e^{-\xi }\right ) -e^{-\xi }\varepsilon \sqrt{\frac{2}{e}}\left ( \frac{5}{4}-\frac{9}{32}\pi \right ) \\ & +\sqrt{\frac{2}{e}}\frac{e^{\frac{x^{2}}{2}}}{\sqrt{1+x^{2}}}\left ( 1+\varepsilon \left ( \frac{5}{4}-\frac{9}{32}\pi -x+\frac{3x}{4\left ( 1+x^{2}\right ) ^{2}}-\frac{7x}{8\left ( 1+x^{2}\right ) }+\frac{9}{8}\arctan \left ( x\right ) \right ) \right ) \\ & -\sqrt{\frac{2}{e}} \end{align*}

Or\begin{multline*} y_{\text{uniform}\left ( x\right ) }\thicksim -\sqrt{\frac{2}{e}}e^{-\xi }+e^{-\xi }-e^{-\xi }\varepsilon \sqrt{\frac{2}{e}}\left ( \frac{5}{4}-\frac{9}{32}\pi \right ) \\ +\sqrt{\frac{2}{e}}\frac{e^{\frac{x^{2}}{2}}}{\sqrt{1+x^{2}}}\left ( 1+\varepsilon \left ( \frac{5}{4}-\frac{9}{32}\pi -x+\frac{3x}{4\left ( 1+x^{2}\right ) ^{2}}-\frac{7x}{8\left ( 1+x^{2}\right ) }+\frac{9}{8}\arctan \left ( x\right ) \right ) \right ) \end{multline*} To check validity of the above solution, the approximate solution is plotted against the numerical solution for diﬀerent values of $$\varepsilon =\left \{ 0.1,0.05,0.01\right \}$$. This shows very good agreement with the numerical solution. At $$\varepsilon =0.01$$ the solutions are almost the same.

#### 3.3.6 problem 9.19

Problem Find lowest order uniform approximation to boundary value problem \begin{align*} \varepsilon y^{\prime \prime }+\left ( \sin x\right ) y^{\prime }+y\sin \left ( 2x\right ) & =0\\ y\left ( 0\right ) & =\pi \\ y\left ( \pi \right ) & =0 \end{align*}

Solution

We expect a boundary layer at left end at $$x=0$$.  Therefore, we need to ﬁnd $$y^{in}\left ( \xi \right ) ,y^{out}\left ( x\right ) ,$$ where $$\xi$$ is an inner variable deﬁned by $$\xi =\frac{x}{\varepsilon ^{p}}$$.

Finding $$y^{in}\left ( \xi \right )$$

At $$x=0,$$ we introduce inner variable $$\xi =\frac{x}{\varepsilon ^{p}}$$ and then express the original ODE using this new variable. We also need to determine $$p$$ in the above expression.  Since $$\frac{dy}{dx}=\frac{dy}{d\xi }\frac{d\xi }{dx}$$ then $$\frac{dy}{dx}=\frac{dy}{d\xi }\varepsilon ^{-p}$$. Hence $$\frac{d}{dx}\equiv \varepsilon ^{-p}\frac{d}{d\xi }$$\begin{align*} \frac{d^{2}}{dx^{2}} & =\frac{d}{dx}\frac{d}{dx}\\ & =\left ( \varepsilon ^{-p}\frac{d}{d\xi }\right ) \left ( \varepsilon ^{-p}\frac{d}{d\xi }\right ) \\ & =\varepsilon ^{-2p}\frac{d^{2}}{d\xi ^{2}} \end{align*}

Therefore $$\frac{d^{2}y}{dx^{2}}=\varepsilon ^{-2p}\frac{d^{2}y}{d\xi ^{2}}$$ and the ODE$$\ \varepsilon y^{\prime \prime }+\left ( \sin x\right ) y^{\prime }+y\sin \left ( 2x\right ) =0$$ now becomes\begin{align*} \varepsilon \varepsilon ^{-2p}\frac{d^{2}y}{d\xi ^{2}}+\left ( \sin \left ( \xi \varepsilon ^{p}\right ) \right ) \varepsilon ^{-p}\frac{dy}{d\xi }+\sin \left ( 2\xi \varepsilon ^{p}\right ) y & =0\\ \varepsilon ^{1-2p}\frac{d^{2}y}{d\xi ^{2}}+\left ( \sin \left ( \xi \varepsilon ^{p}\right ) \right ) \varepsilon ^{-p}\frac{dy}{d\xi }+\sin \left ( 2\xi \varepsilon ^{p}\right ) y & =0 \end{align*}

Expanding the $$\sin$$ terms in the above, in Taylor series around zero, $$\sin \left ( x\right ) =x-\frac{x^{3}}{3!}+\cdots$$ gives\begin{align*} \varepsilon ^{1-2p}\frac{d^{2}y}{d\xi ^{2}}+\left ( \xi \varepsilon ^{p}-\frac{\left ( \xi \varepsilon ^{p}\right ) ^{3}}{3!}+\cdots \right ) \varepsilon ^{-p}\frac{dy}{d\xi }+\left ( 2\xi \varepsilon ^{p}-\frac{\left ( 2\xi \varepsilon ^{p}\right ) ^{3}}{3!}+\cdots \right ) y & =0\\ \varepsilon ^{1-2p}\frac{d^{2}y}{d\xi ^{2}}+\left ( \xi -\frac{\xi ^{3}\varepsilon ^{2p}}{3!}+\cdots \right ) \frac{dy}{d\xi }+\left ( 2\xi \varepsilon ^{p}-\frac{\left ( 2\xi \varepsilon ^{p}\right ) ^{3}}{3!}+\cdots \right ) y & =0 \end{align*}

Then the largest terms are $$\left \{ \varepsilon ^{1-2p},1\right \}$$, therefore $$1-2p=0$$ or $\fbox{p=\frac{1}{2}}$ The ODE now becomes$$y^{\prime \prime }+\left ( \xi -\frac{\xi ^{3}\varepsilon }{3!}+\cdots \right ) y^{\prime }+\left ( 2\xi \sqrt{\varepsilon }-\frac{\left ( 2\xi \sqrt{\varepsilon }\right ) ^{3}}{3!}+\cdots \right ) y=0 \tag{1}$$ Assuming that$y^{left}\left ( x\right ) =\sum _{n=0}^{\infty }\varepsilon ^{n}y_{n}=y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots$ Then (1) becomes$\left ( y_{0}^{\prime \prime }+\varepsilon y_{1}^{\prime \prime }+\cdots \right ) +\left ( \xi -\frac{\xi ^{3}\varepsilon }{3!}+\cdots \right ) \left ( y_{0}^{\prime }+\varepsilon y_{1}^{\prime }+\cdots \right ) +\left ( 2\xi \sqrt{\varepsilon }-\frac{\left ( 2\xi \sqrt{\varepsilon }\right ) ^{3}}{3!}+\cdots \right ) \left ( y_{0}+\varepsilon y_{1}+\cdots \right ) =0$ Collecting terms in $$O\left ( 1\right )$$ gives the balance\begin{align*} y_{0}^{\prime \prime }\left ( \xi \right ) & \thicksim -\xi y_{0}^{\prime }\left ( \xi \right ) \\ y_{0}\left ( 0\right ) & =\pi \end{align*}

Assuming $$z=y_{0}^{\prime }$$, then\begin{align*} z^{\prime } & \thicksim -\xi z\\ \frac{dz}{z} & \thicksim -\xi \\ \ln \left \vert z\right \vert & \thicksim -\frac{\xi ^{2}}{2}+C_{1}\\ z & \thicksim C_{1}e^{\frac{-\xi ^{2}}{2}} \end{align*}

Therefore $$y_{0}^{\prime }\thicksim C_{1}e^{\frac{-\xi ^{2}}{2}}$$. Hence $y_{0}\left ( \xi \right ) \thicksim C_{1}\int _{0}^{\xi }e^{\frac{-s^{2}}{2}}ds+C_{2}$ With boundary conditions $$y\left ( 0\right ) =\pi$$. Hence$\pi =C_{2}$ And the solution becomes$$y_{0}^{in}\left ( \xi \right ) \thicksim C_{1}\int _{0}^{\xi }e^{\frac{-s^{2}}{2}}ds+\pi \tag{2}$$ Now we need to ﬁnd $$y^{out}\left ( x\right )$$.  Assuming that$y^{out}\left ( x\right ) =\sum _{n=0}^{\infty }\varepsilon ^{n}y_{n}=y_{0}+\varepsilon y_{1}+\varepsilon ^{2}y_{2}+\cdots$ Then $$\varepsilon y^{\prime \prime }+\left ( \sin x\right ) y^{\prime }+y\sin \left ( 2x\right ) =0$$ becomes$\varepsilon \left ( y_{0}^{\prime \prime }+\varepsilon y_{1}^{\prime \prime }+\cdots \right ) +\sin \left ( x\right ) \left ( y_{0}^{\prime }+\varepsilon y_{1}^{\prime }+\cdots \right ) +\sin \left ( 2x\right ) \left ( y_{0}+\varepsilon y_{1}+\cdots \right ) =0$ Collecting terms in $$O\left ( 1\right )$$ gives the balance\begin{align*} \sin \left ( x\right ) y_{0}^{\prime }\left ( x\right ) & \thicksim -\sin \left ( 2x\right ) y_{0}\left ( x\right ) \\ \frac{dy_{0}}{y_{0}} & \thicksim -\frac{\sin \left ( 2x\right ) }{\sin \left ( x\right ) }dx\\ \ln \left \vert y_{0}\right \vert & \thicksim -\int \frac{\sin \left ( 2x\right ) }{\sin \left ( x\right ) }dx\\ & \thicksim -\int \frac{2\sin x\cos x}{\sin \left ( x\right ) }dx\\ & \thicksim -\int 2\cos xdx\\ & \thicksim -2\sin x+C_{5} \end{align*}

Hence\begin{align*} y_{0}^{out}\left ( x\right ) & \thicksim Ae^{-2\sin x}\\ y_{0}\left ( \pi \right ) & =0 \end{align*}

Therefore $$A=0$$ and $$y_{0}^{out}\left ( x\right ) =0.$$Now that we found all solutions, we can do the matching. The matching on the left side gives\begin{align} \lim _{\xi \rightarrow \infty }y^{in}\left ( \xi \right ) & =\lim _{x\rightarrow 0}y^{out}\left ( x\right ) \nonumber \\ \lim _{\xi \rightarrow \infty }C_{1}\int _{0}^{\xi }e^{\frac{-s^{2}}{2}}ds+\pi & =\lim _{x\rightarrow 0}C_{5}e^{-2\sin x}\nonumber \\ \lim _{\xi \rightarrow \infty }C_{1}\int _{0}^{\xi }e^{\frac{-s^{2}}{2}}ds+\pi & =0 \tag{3} \end{align}

But $\int _{0}^{\xi }e^{\frac{-s^{2}}{2}}ds=\sqrt{\frac{\pi }{2}}\operatorname{erf}\left ( \frac{\xi }{\sqrt{2}}\right )$ And $$\lim _{\xi \rightarrow \infty }\operatorname{erf}\left ( \frac{\xi }{\sqrt{2}}\right ) =1$$, hence (3) becomes\begin{align} C_{1}\sqrt{\frac{\pi }{2}}+\pi & =0\nonumber \\ C_{1} & =-\pi \sqrt{\frac{2}{\pi }}\nonumber \\ & =-\sqrt{2\pi } \tag{4} \end{align}

Therefore from (2)$$y_{0}^{in}\left ( \xi \right ) \thicksim -\sqrt{2\pi }\int _{0}^{\xi }e^{\frac{-s^{2}}{2}}ds+\pi \tag{5}$$ Near $$x=\pi$$, using $$\eta =\frac{\pi -x}{\varepsilon ^{p}}$$. Expansion $$y^{in}\left ( \eta \right ) \thicksim y_{0}\left ( \eta \right ) +\varepsilon y_{1}\left ( \eta \right ) +O\left ( \varepsilon ^{2}\right )$$ gives $$p=\frac{1}{2}$$. Hence $$O\left ( 1\right )$$ terms gives\begin{align*} y_{0}^{\prime \prime }\left ( \eta \right ) & \thicksim \eta y_{0}^{\prime }\left ( \eta \right ) \\ y_{0}^{in}\left ( 0\right ) & =0\\ y_{0}^{in}\left ( \eta \right ) & \thicksim D\int _{0}^{\eta }e^{\frac{-s^{2}}{2}}ds \end{align*}

And matching on the right side gives\begin{align} \lim _{\eta \rightarrow \infty }y^{in}\left ( \eta \right ) & =\lim _{x\rightarrow \pi }y^{out}\left ( x\right ) \nonumber \\ \lim _{\eta \rightarrow \infty }D\int _{0}^{\eta }e^{\frac{-s^{2}}{2}}ds & =0\nonumber \\ D & =0 \tag{6} \end{align}

Therefore the solution is\begin{align} y\left ( x\right ) & \thicksim y^{in}\left ( \xi \right ) +y^{in}\left ( \eta \right ) +y^{out}\left ( x\right ) -y^{match}\nonumber \\ & \thicksim -\sqrt{2\pi }\int _{0}^{\xi }e^{\frac{-s^{2}}{2}}ds+\pi +0\nonumber \\ & \thicksim -\sqrt{2\pi }\sqrt{\frac{\pi }{2}}\operatorname{erf}\left ( \frac{\xi }{\sqrt{2}}\right ) +\pi \nonumber \\ & \thicksim -\sqrt{2\pi }\sqrt{\frac{\pi }{2}}\operatorname{erf}\left ( \frac{x}{\sqrt{2\varepsilon }}\right ) +\pi \nonumber \\ & \thicksim \pi -\pi \operatorname{erf}\left ( \frac{x}{\sqrt{2\varepsilon }}\right ) \tag{7} \end{align}

The following plot compares exact solution with (7) for $$\varepsilon =0.1,0.05$$.   We see from these results, that as $$\varepsilon$$ decreased, the approximation solution improved.

#### 3.3.7 key solution of selected problems

3.3.7.1 section 9 problem 9
3.3.7.2 section 9 problem 15
3.3.7.3 section 9 problem 19
3.3.7.4 section 9 problem 4b
3.3.7.5 section 9 problem 6