Thickness of the Boundary Layer Given an ODE
$$\epsilon y''+2xy'=x \cos(x)$$
with boundary condition $y(\pm {\pi \over 2})=2$
Where is the boundary layer and what is the thickness of it? 
 A: Outer solution
You have the outer equation
$$
y'=\tfrac12\cos x\implies y(x)=C+\tfrac12\sin x
$$
Provided there are no jumps (rapid changes) at the outer boundaries, the left boundary condition leads to $y(x)=\tfrac52+\tfrac12\sin x$, the right boundary condition to $y(x)=\tfrac32+\tfrac12\sin x$

Where the inner or boundary layer is not
For the inner parametrization $x=x_0+δ X$ and $Y(X)=y(x_0+δ X)$ the equation reads
$$
ϵY''+2δ(x_0+δ X)Y'=δ^2(x_0+δ X)\cos(x_0+δ X).
$$
For $x_0\notin\{-\frac\pi2,0,\frac\pi2\}$ a first reduction of infinitesimal versus appreciable quantities leads to
$$
ϵY''+2δx_0Y'=δ^2x_0\cos(x_0)
$$
where the only interesting case is for $δ\sim ϵ$. Taking $ϵ=2δ·|x_0|$ leads to the observation that the solution to the inner equation $Y''\pm Y'=0$ must be locally constant, since the exponential term of it is unbounded. However, to be locally (nearly) constant is equivalent to being continuous, which is satisfied by the outer solutions.

For $x_0=\pm\frac\pi2$ the right side reduces to $\mp δ^3x_0^2$, the reduced equation thus corresponds to the former case. The exponential term of the solution is still not bounded inside the interval, thus providing no jump.

Inner layer
For $x_0=0$, $x=δX$, a first reduction of the singular equation removing non-essential infinitesimals reads as
$$
ϵY''+2δ^2 XY'=δ^3 X.
$$
Since $δ^3\ll δ^2$ the only non-trival case appears for $ϵ=δ^2$. The reduced inner equation is
$$
Y''+2XY'=0\implies Y'=C·e^{-X^2}\implies Y(X)=C·\int_0^Xe^{-s^2}ds+D
$$
with limits $Y(-\infty)=D-C·\frac{\sqrt{\pi}}2$ and $Y(\infty)=D+C·\frac{\sqrt{\pi}}2$.

Approximation formula
For the jump from $\frac52$ to $\frac32$ one needs $D=2$ and $C=-\frac{1}{\sqrt{\pi}}$ giving the total approximation as
$$
y_{approx}(x)=2+\tfrac12\bigl(\sin x-\text{erf}(x/\sqrtϵ)\bigr)
$$

The exponent for the boundary layer thickness is thus $\frac12$.

