# Mysterious inconsistency in an inhomogeneous linear 2nd order ODE with specified boundary values

I am trying to solve $$J''(\tau) = h (J - B) \tag{1}$$ where $h$ is a positive real constant and $B$ is a real-valued, smooth and otherwise well-behaved function for $\tau \in (0, \infty)$. I have the boundary conditions

$$J(0) = 0 \\ \lim_{\tau \to \infty} J = \lim_{\tau \to \infty} B \equiv B_{\infty} \tag{2}$$ I'm using this equation in a physical model, and I have reason to expect $B_\infty$ to be positive (nonzero).

Here's my attempt at a solution:

A solution basis for the homogeneous equation is $J_1 = e^{\sqrt{h} \tau}$ and $J_2 = e^{-\sqrt{h} \tau}$.

The Wronskian evaluates to $-2\sqrt{h}$, a constant.

Then I use variation of parameters to write the general solution as

$$J = e^{\sqrt{h} \tau}\left[\int_{\tau}^{\infty} \frac{h \,B(s)}{2\sqrt{h}} e^{-\sqrt{h} s}ds + C_1\right] +e^{-\sqrt{h} \tau}\left[\int_0^{\tau} \frac{h \,B(s)}{2\sqrt{h}} e^{\sqrt{h} s}ds + C_2\right] \tag{3}$$

I have tried my best to get the signs right above, although there's still a chance I got it wrong, so please let me know if you spot something that's not quite right. In the first integral, I put $\tau$ as the lower limit, which canceled a minus sign out front. And the minus signs in the Wronskians cancel with the minus signs in front of $h B$.

To prevent the solution from diverging as $\tau \to \infty$, $C_1$ must be zero.

I have been able to use the $\tau = 0$ boundary condition to derive an expression for $C_2$.

But here's the problem. Consider once again the $\tau \to \infty$ boundary condition. If I plug in $C_1 = 0$ into the general solution (equation 3 above), and drop all terms that clearly vanish, I am left with

$$\lim_{\tau \to \infty} J = \lim_{\tau \to \infty} e^{-\sqrt{h} \tau} \int_0^{\tau} \frac{h \,B(s)}{2\sqrt{h}} e^{\sqrt{h} s}ds \tag{4}$$

Then, using L'Hospital's rule,

$$\lim_{\tau \to \infty} J = \frac{\frac{h \,B(\tau)}{2\sqrt{h}} e^{\sqrt{h} \tau}}{\sqrt{h} e^{\sqrt{h} \tau}} \tag{5}$$

which simplifies to

$$\lim_{\tau \to \infty} J = \frac{1}{2} \lim_{\tau \to \infty} B \tag{6}$$

It seems that the only way that the second boundary condition (second line of equation 2) can be satisfied is if $B_{\infty} = 0$. But as I noted above, on physical grounds I expect $B_{\infty} = 0$ to be able to take arbitrary positive values. Have I done something wrong, or is it really the case that $B_{\infty}$ must equal zero in this situation?

I found my problem, finally. When going between equation 3 and equation 4, there are actually two terms that don't vanish, not just one, as $\tau \to \infty$ (the two integral terms). L'Hospital is needed both times to handle the indeterminate forms, and they both evaluate to $1/2 B_{\infty}$. So they sum to $B_{\infty}$ and all is consistent.