Solving the ODE $[(1-x^2)\frac{\partial}{\partial x} - \lambda]f = [\frac{\partial}{\partial x} - \frac{\lambda}{a}]g$ I want to solve $f(x)$ in terms of $g(x)$ in the following ODE
$$\left[(1-x^2)\frac{\partial}{\partial x} - \lambda\right]f(x) = \left[\frac{\partial}{\partial x} - \frac{\lambda}{a}\right]g(x),$$
where the constants and boundary conditions are
\begin{aligned}
\lambda \in & \mathbb{C}, \quad \text{Re}[\lambda] < 0 \\
a \in & \mathbb{R} \\
\lim_{x\to\pm\infty}f(x) = & 0 \\
\lim_{x\to\pm\infty}g(x) = & 0.
\end{aligned}
I expect $f$ and $g$ to be nice (without singular behaviour).
Questions
1. How can I get a solution which is valid for all $x$? $x=\pm1$ is especially problematic.
2. What kind of ODE is this?
3. Are there better methods than the one I chose?
My approach
Multiply by $\frac{e^{-h(x)}}{1-x^2}$, and integrate over $x$:
\begin{aligned}
\text{LHS} & = \int e^{-h(x)}\frac{\partial f}{\partial x} dx - \int \frac{e^{-h(x)}}{1-x^2}\lambda fdx = \\
           & = \left\{\text{Partial Integration}\right\} = \\
           & = fe^{-h(x)} - \int\frac{\partial (-h)}{\partial x} fe^{-h(x)}dx - \int \frac{\lambda}{1-x^2}fe^{-h(x)}dx.
\end{aligned}
Choose $h(x)$ such that the two integrals cancel
\begin{aligned}
\frac{\partial (-h)}{\partial x} & = -\frac{\lambda}{1-x^2} \quad \Rightarrow \\
h(x) & = \int \frac{\lambda}{1-x^2} dx = \frac{\lambda}{2}\ln\left(\frac{1+x}{1-x}\right).
\end{aligned}
We get
\begin{aligned}
fe^{-h(x)} & = \int\frac{e^{-h(x)}}{1-x^2}\left[\frac{\partial}{\partial x} - \frac{\lambda}{a}\right]g(x) dx =\\
& = \int\frac{e^{-h(x)}}{1-x^2}\frac{\partial g}{\partial x}dx - \int\frac{\lambda}{a}\frac{e^{-h(x)}}{1-x^2}g dx\\
& = \left\{\text{Partial Integration}\right\} =\\
& = \frac{ge^{-h(x)}}{1-x^2} - \int g\frac{\partial}{\partial x}\left(\frac{e^{-h(x)}}{1-x^2}\right)dx - \int\frac{\lambda}{a}\frac{e^{-h(x)}}{1-x^2}g dx
\end{aligned}
Finally, multiplying both sides with $e^{h(x)}$, $f$ is found to be
\begin{aligned}
f(x) & = \frac{g(x)}{1-x^2} - e^{h(x)}\int\left(\frac{2x-\lambda}{1-x^2}+\frac{\lambda}{a}\right)\frac{e^{-h(x)}}{1-x^2}gdx\\
h(x) & = \frac{\lambda}{2}\ln\left(\frac{1+x}{1-x}\right).
\end{aligned}
Is it possible to simplify further? This is not valid for $x=\pm1$...
Alternate approach
Instead of indefinite integrals, use definite integrals from $x_0$ to $x$. My result in this case is
\begin{aligned}
f(x) = & \left[f(x_0) - \frac{g(x_0)}{1-x_0^2}\right]e^{h(x_0,x)} + \\
     + & \frac{g(x)}{1-x^2} - \\
     - & \int\limits_{x_0}^{x}\left(\frac{2t-\lambda}{1-t^2}+\frac{\lambda}{a}\right)\frac{e^{h(t,x)}}{1-t^2}g(t)dt\\
h(t,x) & = \frac{\lambda}{2}\ln\left(\frac{(1+x)(1-t)}{(1-x)(1+t)}\right).
\end{aligned}
Note that as $x\to\infty$, this solution is equivalent to the previous one. Maybe the method with $x_0$ can be used in each respective region? I can't solve it for the middle region though ($|x|<1$), and there's still a problem with $x=\pm1$.
 A: I am not sure to well understand the question. This my own interpretation. Am I correct ?
$$\left[(1-x^2)\frac{\partial}{\partial x} - \lambda\right]f(x) = \left[\frac{\partial}{\partial x} - \frac{\lambda}{a}\right]g(x)$$ is a first order linear ODE.
You want to solve $f(x)$ in terms of $g(x)$ means that first you set a function $g(x)$ and then solve the ODE. So, it is not correct to say "I expect $g$ to be nice" : You just set a nice $g(x)$.
Solving the ODE on a classical way is shown in attachment. 
Then, satisfying the given conditions depends on the chosen function $g(x)$. For the conditions of regularity at $x=1$ and $x=-1$, one have to expend de function $g(x)$ at each of these points and bing it back into the integral.

An other idea is to proceed on the reverse way : first we express $g(x)$ in terms of $f(x)$ : see below. 
Then, if we chose a so called "nice" function $f(x)$, the formula allows to compute $g(x)$. There is nothing in the integral which can introduce an irregularity. So, the result is a "nice" function $g(x)$. 
Now, if we comme back to the first beginning and start with the $g(x)$ already obtained and put it back into the initial ODE, of course, the solution will be the "nice" function $f(x)$. That way we have a couple of "nice" functions $g(x), f(x)$.

