1 Dimensional ODE with solution in $L^2$ For part of a bigger question, I need either a solution or a counterexample to the following 1 dimensional ODE.
Let $h\in L^2(0,\infty)$ (complex valued functions) and $r \in (0,\infty)$. Under boundary conditions $w(0) = c_1a + c_2$ and $w'(0) = c_3a + c_4$ where the $c_i$ are complex constants and $a$ is a complex parameter, is there an $a \in \mathbb{C}$ for which there is a solution in $H^2(0,\infty)$ for:
$$w''(t) = irw(t) - h(t) \ \ \ (t\in (0,\infty))?$$
The strange boundary conditions are just my way of saying that there is one parameter I want to solve for if a solution exists in order to couple this ODE with another one on the negative real line.
If I use Laplace transforms, this is equivalent to asking if there exists $w \in H^2(0,\infty)$ such that
$$\hat{w} = \frac{\hat{h}}{ir-s^2} - \frac{w(0)+sw'(0)}{ir - s^2}.$$
There is a solution to this ODE by taking the inverse Laplace transform of the above equation, namely
$$ w(t) = -\frac{1}{\sqrt{ir}}\int_0^t h(u)\sinh(\sqrt{ir}(t-u))du + \frac{w(0)}{\sqrt{ir}}\sinh(\sqrt{ir}t) + w'(0)\cosh(\sqrt{ir}t).$$
However, this is not obvious to me whether or not there is an $a$ for which it's in $L^2(0,\infty)$. Is there another solution to this ODE that is in $L^2(0,\infty)$ or if not, is there an explicit counterexample? In other words, given $h\in L^2(0,\infty)$, are there nonhomogeneous boundary conditions of the form aforementioned that give me a solutions $w\in H^2(0,\infty)$.
 A: 
1. Consider the homogeneous case, i.e., $h=0$.

The two linearly independent solutions are $e^{\pm \sqrt{ir} t}$, where we take the principle branch cut of $\sqrt\cdot$. In order to make the solution $L^2[0,\infty)$, you need to discard the exponentially growing solution $e^{\sqrt{ir} t}$ and keep only the decaying one $e^{-\sqrt{ir} t}$. So $\sinh$ and $\cosh$ can not be used alone but only in equal weight pair in each of your terms. Explicitly 
$$w(t)=w(0)e^{-\sqrt{ir} t},$$
and $w'(0)=-w(0)\sqrt{ir}$. Substitute in the linear form of $w(0)$ and $w'(0)$, we can easily obtain the condition on $a$ which is $a=-\frac{c_1\sqrt{ir}+c_3}{c_2\sqrt{ir}+c_4}$ if the denominator does not vanish, and any $a\in\Bbb C$ if both the denominator and numerator vanish, and does not exist if only the denominator vanishes.

2. Now consider the inhomogeneous case but with homogeneous boundary condition, i.e., $h\not\equiv0$ and $w(0)=w'(0)=0$.

There are two interesting cases for two different Green's functions. The difference of these two Green's function is a homogeneous solution. 
2.1 The first Green's function is $$G_1(t)=\frac1{k}\sinh(kt)\Theta(t)$$
where $k=\sqrt{ir}$ and $\Theta$ is the Heaviside step function.
$$w(t)=-\int_0^t h(u)G_1(t-u)du.$$
There are many $h$'s (counterexamples saught by the OP) making $w\notin L^2[0,\infty)$ for $G_1$: (1) $h(t)=e^{-at}\in L^2[0,\infty)$ with some positive $a$; (2) any $h\in C[0,\infty)$ compactly supported and positive on $(0,T)$ for some positive $T$.
For $G_1$, to produce $w\in L^2[0,\infty)$ with a nonzero $h\in L^2[0,\infty)\cap C[0,\infty)$, both the real part and imaginary part of $h$ have to alternate their signs over $t\in[0,\infty)$.
2.2 The second Green's function is 
$$G_2(t)=-\frac1{2k}e^{-k|t|}.$$
Then
$$w(t)=-\int_0^\infty h(u)G_2(t-u)du+\int_0^\infty h(u)G_2(-u)du=-h*G_2+(h*G_2)(t=0),$$
where $*$ stands for convolution. The second term is to ensure the null initial condition. $G_2\in L^1[0,\infty)$. By Young's convolution inequality, 
$$\|h*G\|_2\le \|h\|_2\|G_2\|_1,$$
and $w\in L^2[0,\infty),\, \forall h\in L^2[0,\infty)$. 
Note: As indicated before, $G_1-G_2=\frac{e^{kt}}k$ a solution of the homogeneous equation.
Separating out the "explosive" exponentially growing term $e^{kt}$ from $\sinh(kt)$ of $G_1(t)$, we have the following proposition regarding the square integrability of $w$.

3. Proposition 1.: $\forall k\in\Bbb C\,\ni \mathbf{Re}(k)>0 \implies \exists h\in L^2[0,\infty) \ni \big(w[h,a](t):=\int_0^t h(u)e^{k(t-u)}\,du-ae^{kt}\notin L^2[0,\infty),\, \forall a\in\Bbb C-\{0\} \big).$

Proof: Take the Laplace transformation of $w[h,a]$
\begin{align}
\mathscr L[w]&=\mathscr L[h]\mathscr L[e^{kt}]-a\mathscr L[e^{kt}], \tag1\\
\mathscr L[e^{kt}](s)&=\frac1{s-k}.
\end{align}
$\mathscr L[h]\in H^{2+}$ the Hardy function space on the right half complex plane iff $h\in L^2[0,\infty)$. Let 
$$\mathscr L[h](s)=\frac{s-k}{(s+\alpha)(s+\beta)},$$
or equivalently
$$h(t)=\frac{(\beta+k)e^{-\beta t}-(\alpha+k)e^{-\alpha t}}{\beta-\alpha},\tag2$$
for some $\alpha,\beta\in\Bbb C$ where $\mathbf{Re}(\alpha)>0,\mathbf{Re}(\beta)>0$. $\mathscr L[h]\in H^{2+}$ since  it is a proper fractional function and its poles are all in the left half complex plane. By Eq. (1), there is always a simple pole at $k$ in the right half complex plane so long as $a\ne0$. Then $\mathscr L\big[w[h,a]\big]\notin H^{2+}$ and $w[h,a]\notin L^2[0,\infty),\,\forall a\ne0$. This can also be verified by direct computation of $w$ with the chosen $h$ with the explicit expression Eq. (2). $\quad\square$

4. Proposition 2: $$k\in\Bbb C\,\ni \mathbf{Re}(k)>0, h\in L^2[0,\infty) \implies \exists !a\in\Bbb C \ni \big(w[a](t):=\int_0^t h(u)e^{k(t-u)}\,du-ae^{kt}\in L^2[0,\infty)\big).$$

Proof: Take the Laplace transformation of $w[h,a]$
\begin{align}
\mathscr L[w]&=\mathscr L[h]\mathscr L[e^{kt}]-a\mathscr L[e^{kt}], \tag1\\
\mathscr L[e^{kt}](s)&=\frac1{s-k}.
\end{align}
$\mathscr L[h]\in H^{2+}$ the Hardy function space on the right half complex plane iff $h\in L^2[0,\infty)$. Let $D(\omega;R)$ be the closed disk centered at $\omega$ and radius $0<R<\mathbf{Re}(k)$. For an arbitrary $x\ge 0$, let $\Omega_x:=\{x+iy\}\setminus D(\omega-k,R)$. We consider two cases.
(1)$k$ is not one of the zeros.
$$\frac{\mathscr L[h]}{s-k}=\frac{\mathscr L[h](s)-\mathscr L[h](k)}{s-k}+\frac{\mathscr L[h](k)}{s-k}$$
$\phi(s):=\frac{\mathscr L[h](s)-\mathscr L[h](k)}{s-k}$. $\phi(s)$ is holomorphic on the closed right half complex plane.
We will prove that $\phi(s)$ is square integrable and uniformly bounded along all vertical line on the right hand side complex plane. $|\phi(s)|$ has a maximum on the compact $D(k,R)$.
$$|\phi(s)|^2\le \frac{|\mathscr L[h](s)|^2}{R^2}+\frac{|\mathscr L[h](k)|^2}{|s-k|^2},\ \forall |s-k|\ge R.$$
We have
$$\int_{\Omega_x} |\phi(x+iy)|^2 dy\le \frac1{R^2}\int_{\Omega_x} |\mathscr L[h](x+iy)|^2dy+\frac{\pi |\mathscr L[h](k)|^2}{2\,\max(x,R)}.$$
The integral on the right hand side is bounded uniformly over all $x\ge0$ as $\mathscr L[h]\in H^{2+}$. So now too is the left hand side. We conclude $\phi\in H^{2+}$.
Then setting and only setting $a=\mathscr L[h](k)$ leads to the desired result.
(2) $k$ is one of the zeros.
$\phi(s):=\frac{\mathscr L[h](s)}{s-k}$.  $\frac{\mathscr L[h]}{s-k}\in H^{2+}$. Again $\phi$ is holomorphic on $B(k;R)$.  
We will prove that $\phi(s)$ is square integrable and uniformly bounded along all vertical line on the right hand side complex plane. $|\phi(s)|$ has a maximum on the compact $D(k,R)$.
$$\int_{\Omega_x} |\phi(x+iy)|^2 dy\le \frac1{R^2}\int_{\Omega_x} |\mathscr L[h](x+iy)|^2dy.$$
The integral on the right hand side is bounded uniformly over all $x\ge0$ as $\mathscr L[h]\in H^{2+}$. Then so is the left hand side. We conclude $\phi\in H^{2+}$.
Setting and only setting $a=0$ leads to the desired result. 
$\quad\square$
