<s>[INST] Converting a differential equation to a hypergeometric equation I would like  to transform the following differential equation into a hypergeometric equation:
${z^2}\frac{{{d^2}W}}{{d{z^2}}} + z\frac{{{d^{}}W}}{{d{z^{}}}} + \left( {{A^2} - {B^2}\left( {1 - {C_{}}z + D\frac{{z\,}}{{{{\left( {1 - z} \right)}^{}}}}} \right) - \frac{F}{{{{\left( {1 - z} \right)}^2}}}} \right)W = 0.$
Here A, B, C, D and F are constants.
I tried by letting I tried by letting $W = {z^p}{\left( {1 - z} \right)^q}y.$
After replacing it into the above equation, I  ran into trouble trying to "fit" the values of p and q so that the y  term in the resulting equation would be independent of z.  I thought it was a  straightforward thing to do.  However, the values that I got for p and q did not reduce the equation to a hypergeometric one. Obviously, I am missing something simple here.
Any advice will be most appreciated.
 [/INST] Using
\begin{align}
w &= x^p \, (1-x)^q \, y \\
w' &= x^p \, (1-x)^q \, \left(y' + \left(\frac{p}{x} - \frac{q}{1-x}\right) \, y \right) \\
w'' &= x^p \, (1-x)^q \, \left(y'' + \left(\frac{2 p}{x} - \frac{2 q}{1-x}\right) \, y' + \left(\frac{p(p-1)}{x^2} - \frac{2 p q}{x(1-x)} + \frac{q(q-1)}{(1-x)^2} \right) \right)
\end{align}
then the equation
$$ x^2 \, w'' + x \, w' + \left(a + b \, x + \frac{c \, x}{1-x} - \frac{d}{(1-x)^2} \right) \, w = 0 $$
can be transformed as seen in the following. The differential equation can be placed into the form
$$x (1-x) \, w'' + (1-x) \, w' + \left((-a+b+c) + \frac{a-d}{x} - \frac{d}{1-x} \right) \, w = 0.$$
From here, and with the substitutions, this equation can be reduced to
$$x (1-x) \, y'' + ((2p+1) - (2p+2q+1) \, x) \, y' + f(x) \, y = 0,$$
where
$$ f(x) = -(p+q)^2 - a + b + c + \frac{p^2 + a - d}{x} + \frac{q(q-1)-d}{1-x}. $$
This yields the equations $q(q-1) - d=0$ and $p^2 + a -d = 0$. Now that the equation is further reduced it is determined that the resulting form is
$$x (1-x) \, y'' + ((2p+1) - (2p+2q+1) \, x) \, y' - ((p+q)^2 + a - b - c) \, y = 0.$$
Comparing this to the desired hypergeometric equation, namely,
$$ x (1-x) \, y'' + (\gamma - (\alpha + \beta + 1) \, x) \, y' - \alpha \, \beta \, y = 0 \\
y(x) = {}_{2}F_{1}(\alpha, \beta; \gamma; x)$$
then, by using $\alpha \beta = (p+q)^2 + a - b - c$ and $\alpha + \beta = 2p + 2q$,
$$ y(x) = {}_{2}F_{1}(\phi_{1}, \phi_{2}; 2p+1; x),$$
where $\phi_{1} = p+q+\sqrt{c+b-a}$ and $\phi_{2} = p+q-\sqrt{c+b-a}$.
The $w(x)$ form is
$$ w(x) = x^p \, (1-x)^q \, {}_{2}F_{1}(\phi_{1}, \phi_{2}; 2p+1; x), $$
where
\begin{align}
& p^2 + a -d = 0 \\
& q(q-1) - d = 0 \\
& \phi_{1} = p+q+\sqrt{c+b-a} \\
& \phi_{2} = p+q-\sqrt{c+b-a}.
\end{align}
Solving for $p$ and $q$, equating the coefficients in general, and making the necessary reductions should lead to the desired solution.
</s>