<s>[INST] Solving ODE using frobenius method. 3 coefficients I'm trying to learn frobenius method by solving some problems (ODEs).
For example:
$$xy''+(2x+1)y'+(x+1)y=0$$
Let $y=\sum\limits_{n=0}^\infty a_nx^{n+r}$. Then, I took derivatives and put into the equation:
$$\sum\limits_{n=0}^\infty a_n(n+r)^2x^{n+r-1}+2\sum\limits_{n=0}^\infty a_n(n+r+1)x^{n+r}+\sum\limits_{n=0}^\infty a_nx^{n+r+1}=0$$
After I shifted to make their orders same:
$$\sum\limits_{k=-2}^\infty a_{k+2}(k+r+2)^2x^{k+r+1}+2\sum\limits_{k=-1}^\infty a_{k+1}(k+r+2)x^{k+r+1}+\sum\limits_{k=0}^\infty a_kx^{k+r+1}$$
And if I leave first $k=-2, k=-1$ parts, I can find relationship among 3 coefficient:
$$\sum\limits_{k=0}^\infty [x^{k+r+1}(a_{k+2}(k+r+2)^2+a_{k+1}(k+r+2)+a_k)]=0$$
Now, here I could find relationship with $a_{k+2},a_{k+1},a_k$. But, in this method we should find proportionality between 2 coefficients, not 3. For example, this: Frobenius Method to solve $x(1 - x)y'' - 3xy' - y = 0$
Can you, please, suggest a solution? 
 [/INST] You state:

After I shifted to make their orders same:
  $$
\sum_{k = -2}^\infty a_{k + 2}(k + r + 2)^2 x^{k + r + 1} + 2 \sum_{k = -1}^\infty a_{k + 1}(k + r + 2)x^{k + r + 1}+\sum_{k = 0}^\infty a_k x^{k + r + 1}
$$

What you do is the following. Given that
$$
\sum_{k = 0}^\infty a_k (k + r)^2 x^{k + r - 1} + \sum_{k = 0}^\infty a_k(2 k + 2 r + 1)x^{k + r} + \sum_{k = 0}^\infty a_k x^{k + r + 1}
$$
(note that your second sum was incorrectly calculated)
you need to separate the necessary terms of the sums in order to group the powers of $x$ correctly, i.e:
\begin{multline}
\sum_{n = 0}^\infty a_n (n + r)^2 x^{n + r - 1} + 2 \sum_{n = 0}^\infty a_n (n + r + 1) x^{n + r} + \sum_{n = 0}^\infty a_n x^{n + r + 1} = \\
a_0 r^2 x^{r-1} + a_1 (r + 1)^2 x^r + \sum_{n=2}^\infty a_n (n + r)^2 x^{n + r - 1} + (2 r + 1) a_0 x^r + \\ \sum\limits_{n = 1}^\infty a_n (2 n + 2 r+ 1)x^{n + r} +\sum_{n = 0}^\infty a_n x^{n + r + 1} = 0
\end{multline}
Regrouping orders, you have
\begin{multline}
a_0 r^2 x^{r-1} + [a_1 (r + 1) + a_0 (2 r + 1)] x^r + \\ \sum_{k = 0}^\infty \left\{ a_{k + 2}(k + r + 2)^2 + 2 a_{k + 1} (k + r + 2) + a_k \right\} x^{k + r + 1} = 0
\end{multline}
Each power of $x$ needs to vanish, hence $r^2 = 0$. This is the indicial polynomial (details here). This means that $r = 0$ and
\begin{align}
a_1 + a_0 &= 0 \\
a_{k + 2}(k + 2)^2 + 2 a_{k + 1} (2 k + 3) + a_k &= 0
\end{align}
which closes the recurrence relation. The first tree terms are
\begin{align}
a_1 &= -a_0\\
a_2 &= \frac{1}{2!}a_0\\
a_3 &= -\frac{1}{3!}a_0
\end{align}
and it's clear that a relationship is forming. By induction, the whole solution can be computed.
Note that, assuming that $y$ is somehow well behaved, for $x \sim 0$,
$$
x y'' + (2x + 1) y' + (x + 1) y = 0 \quad \sim \quad y' + y = 0.
$$
Proposing the anzats $y(x) = e^{-x} z(x)$ and substituting in the original ode,
$$
x y'' + (2x + 1) y' + (x + 1) y = e^{-x}\left(x z'' + z'\right) = 0,
$$
and it's easily verified that $z = c_1 \log x + c_2$. Hence
$$
y(x) = e^{-x}\left(c_1 \log x + c_2\right)
$$
Cool trick ha?
</s>