Second order ODE with varying parameter

We have this ODE: $$\epsilon {f}^{\prime\prime} +f^\prime=2x+1 \\f(0)=1\\f(1)=4\\ \epsilon\ll1$$ I want to find the exact solution which is given by : $$f(x)=x^2+x+2-e^{\frac{-1}{\epsilon}x}+\epsilon\Big(2(1-x)-2e^{\frac{-1}{\epsilon}x}\Big)$$

My attempt: Rewriting the equation: $${f}^{\prime\prime} +\frac{1}{\epsilon} f^\prime=\frac{2}{\epsilon}x+\frac{1}{\epsilon}$$

Homogeneous solution:$$f_H=c_1+c_2 e^{\frac{-1}{\epsilon}x}$$ It seems that the take the particular solution as: $$f_p=Ax^2 +Bx +C\\{f_P}^\prime= 2Ax+B\\ {f_P}^{\prime\prime}=2A$$ substitute in the problem:$$2A+\frac{1}{\epsilon}(2Ax+B)=\frac{2}{\epsilon}x+\frac{1}{\epsilon} \Longrightarrow A=1, B=1-2\epsilon$$

-General solution: $$f=c_1+c_2 e^{\frac{-1}{\epsilon}x}+x^2+(1-2\epsilon)x$$ -Applying boundary conditions we get: $$c_1=\frac{2(1+\epsilon)-e^\frac{-1}{\epsilon}}{1-e^\frac{-1}{\epsilon}},\qquad c_2=\frac{-(1+2\epsilon)}{ 1-e^\frac{-1}{\epsilon}}$$ -By neglecting the term $$e^\frac{-1}{\epsilon}$$ (which I am not sure why!! ) we get the given solution.

My questions here:

-what about the constant C in the particular solution?

-why we didn’t use a linear polynomial as a particular solution because the right hand side is a linear polynomial ?

• Is your original DE $\epsilon f''+f'=2x+1$ or $\epsilon f''+f=2x+1?$ – Adrian Keister Apr 2 at 20:50
• yes, it is the first one , sorry for forgetting the prime sign in the rewrites equation. I will edit it – F.O Apr 2 at 21:03
• So the $C$ in the particular solution ansatz is superfluous, because you already know it's going to be annihilated by the operator $\epsilon d^2/dx^2+d/dx.$ If it's in the homogeneous solution, there's no point in including it in a particular solution ansatz. – Adrian Keister Apr 2 at 21:11
• Are you sure the solution you cited is labeled "exact solution" or is it the $O(ϵ)$ approximation of the boundary layer approximation, composed of "inner" and "outer" solutions? – LutzL Apr 2 at 21:18
• @LutzL It was actually written f as exact solution when solving the outer problem of the boundary layer.The outer approximate solution doesn’t include the exponential terms – F.O Apr 2 at 21:21

$$C$$ gets combined with $$c_1$$ of the homogeneous solution. Or one could just say that the trial function is $$x(Ax+B)$$.
For the same reason, as the exponential factor $$0$$ is a characteristic root of the left side, the linear trial solution $$Ax+B$$ gets multiplied with $$x$$.
If you were to first integrate both sides, you would find that $$ϵf'+f=x^2+x+c_1$$ where you directly see that the particular solution needs to be a quadratic polynomial.