I've found the homogeneous solution to an inhomogeneous equation, but the particular solution eludes me.
The equation
$$ (ax + b )f(x) + (1 - x^2) f'(x) = c$$
is solved by $f(x) = (1 - x)^{\frac{b+a}{2}} (1 +x )^{\frac{b-a}{2}}$, for $c=0$. But what can you say about $c \neq 0$?
I also have a more general question: I've often seen that the homogeneous solution is used as an "inspiration" to find the inhomogeneous solution. One modifies the homogeneous solution by trial and error until one finds a particular solution. I was wondering, is it just heuristics, or is there a more systematic theory of why it sometimes works and how one should proceed?
First, let's transform the equation into a more simple form by dividing through by $1-x^2$ to obtain $$f'(x)+\frac{ax+b}{1-x^2}f(x)=\frac {c}{1-x^2}$$ To solve this equation for any value of $c$, imagine we have a convenient term $k(x)$ such that $$\begin{align} \frac{ax+b}{1-x^2}f(x)k(x)+f'(x)k(x)&=(f(x)k(x))'\\ &= f'(x)k(x)+k'(x)f(x)\end {align}$$ Subtract $f'(x)k(x)$ from both sides and divide through by $f(x)$ to obtain a differential equation for $k(x)$. $$k'(x)=\frac{ax+b}{1-x^2}k(x)$$ Which can be solved as follows $$\frac{k'(x)}{k(x)}=\ln (k(x))'=\frac{ax+b}{1-x^2}$$ Integrating both sides and exponentiating we obtain an expression for $k$ $$k(x)=P\exp\left(\int \frac{ax+b}{1-x^2}\right)$$ (You can evaluate this integral yourself, it requires partial fractions and the resulting expression will contain logarithms that will simplify with the exponential.)
Now that we have our $k$, we can go back to our equation and multiply through by it. $$f'(x)k(x)+\frac{ax+b}{1-x^2}f(x)k(x)=\frac {ck(x)}{1-x^2}$$ Thanks to the way we constructed $k(x)$ the left side of this equation simplifies to $$(f(x)k(x))'=\frac {ck(x)}{1-x^2}$$ Now simply integrate both sides and divide through by $k$ to obtain $$f(x)=\frac{1}{k(x)}\int \frac {ck(x)}{1-x^2}\mathrm{d}x+\frac{Q}{k(x)}$$ Unfortunately, the integration of the right side is rather messy and it will not lead to a nice result. All throughout this derivation, $P$ and $Q$ are the integration constants and can be solved for by using the initial conditions for your problem.
What you are talking about when saying inspiration is the super position principle, notice that if we have two $f$ and $g$ solutions to a linear ODE $$a(x)f'+b(x)f=c(x)$$ $$a(x)g'+b(x)g=d(x)$$ Then $$a(x)(f+g)'+b(x)(f+g)=a(x)f'+b(x)f+a(x)g'+b(x)g=c(x)+d(x)$$ Normally, we say that the left side of an ODE is the system and the right one the input. What the superposition principle says is that if you have two solutions for the same system but different inputs, then the solution to the sum of said inputs is the sum of the solutions. This is useful when setting $c(x)=0$, solving the homogeneous equation and then finding a particular solution to the inhomogeneous one, then adding them together to find the general solution.