$f\mapsto \frac{df}{dx} - \frac{x}{\sqrt{1+x^2}}f $ has closed image and $1$-dimensional cokernel 
Let $X$ be the completion of the space of smooth, compactly supported
  real-valued functions on $\mathbb R$ under the norm 
  $$\|f\|_X^2=\int_{\mathbb R} \left(\frac{df}{dx}\right)^2 + f^2.$$ Let
  $Y=L^2(\mathbb R)$.
Prove the map $T:X
\rightarrow Y$ given by $T(f)= \frac{df}{dx}  - \frac{x}{\sqrt{1+x^2}}f $ has
  closed image and $1$-dimensional cokernel.

This is a qualifying exam problem. See Day 2, problem 6(d).
I noticed that $f\mapsto f'-f$ was an isometry, but I'm not sure this is useful. I don't see how to use the fact that the operator is a small perturbation of an isometry. I also tried to identify the adjoint, but I came to the equation
$$(T^*g)''+T^*g=g'-\frac{x}{\sqrt{1+x^2}}g$$
after writing out the definition of adjoint and using integration by parts. This seems intractable. 
I would appreciate any advice about how to proceed.
I think this may be a special case of some more general theorem about Sobolev spaces, but I am unfortunately ignorant of the relevant theory.
Edit: I suspect my equation for the adjoint is wrong. For if $T^*g=0$, then solving the resulting differential equation shows $g=Ce^{\sqrt{x^2+1}}$, which is of course not in $L^2$. So it seems the kernel of the adjoint is trivial, meaning the cokernel of $T$ is trivial. This contradicts the problem statement. 
But its derivation seems correct. We must have 
$$\int (Tf)g=\int f'(T^*g)'+f(T^*g)=\int f((T^*g)'' + (T^*g))$$
for all compactly supported smooth $f$, so the equation follows, or so it seems. Something is clearly amiss. 
 A: The operator
$$
                  Tf = f'-\frac{x}{\sqrt{1+x^{2}}}f
$$
is a bounded operator from $X$ to $Y$ because
$$
\begin{align}
             |Tf| & \le |f'|+|f|,\\
             |Tf|^{2} & \le |f'|^{2}+|f|^{2}+2|f'||f| \\
                      & \le 2|f'|^{2}+2|f|^{2} \\
             \|Tf\|_{Y}^{2} & \le 2\|f\|_{X}^{2}.
\end{align}
$$
To look at the range, let $g \in L^{2}(\mathbb{R})$ and try to solve for $f\in X$ such that
$$
                        f'-\frac{x}{\sqrt{1+x^{2}}}f = g.
$$
This requires an integrating factor:
$$
   \exp\left\{-\int \frac{x}{\sqrt{1+x^{2}}}dx\right\} = e^{-\sqrt{1+x^{2}}}.
$$
The solution must satisfy
$$
         \{e^{-\sqrt{1+x^{2}}}f\}' = e^{-\sqrt{1+x^{2}}}g.
$$
So the solution could be either of the following:
$$
             f(x) = e^{\sqrt{1+x^{2}}}\int_{-\infty}^{x}e^{-\sqrt{1+t^{2}}}g(t)dt \\
            f(x) = -e^{\sqrt{1+x^{2}}}\int_{x}^{\infty}e^{-\sqrt{1+t^{2}}}g(t)dt.
$$
Subtracting these two forms gives
$$
                      0 = \int_{-\infty}^{\infty}e^{-\sqrt{1+t^{2}}}g(t)dt.
$$
The above condition becomes necessary in order to have $f \in X$. Conversely, if the above condition is met, then either of the two forms of solutions are the same, from which you can deduce that $f \in X$ as required. So the co-dimension of the range is $1$, which means the range is closed. It's easy to check that $T$ has trivial null space because $f'-\frac{x}{\sqrt{1+x^{2}}}f=0$ implies $f=Ce^{\sqrt{1+x^{2}}}$ which is not in $X$ unless $C=0$. So $\mathcal{N}(T)=\{0\}$.
