The expansion of a function in powers of a parameter In the perturbation theory for non-degenerate levels, the energy $E_n(\lambda)$ of an eigenstate $|\psi_n(\lambda)\rangle$ of the hamiltonian $\mathcal{H}=\mathcal{H}_0+\lambda \mathcal{H}_1$ (where $\mathcal{H}_0$ is the unperturbed hamiltonian with eigenstates $E_n^0$ and $\lambda\mathcal{H}_1$ is the perturbation) is described by the equation
$$E_n(\lambda)=E_n^0+\dfrac{\lambda\langle\phi_n|\mathcal{H}_1|\phi_n\rangle+\lambda^2\langle\phi_n|\mathcal{H}_1|\psi_n^1\rangle+\lambda^3\langle\phi_n|\mathcal{H}_1|\psi_n^2\rangle+\dots}{1+\lambda a_n^{(1)}+\lambda^2 a_n^{(2)}+\dots}.$$
Here, $|\phi_n\rangle$ is the $n$'th eigenstate of the unperturbed hamiltonian, and $a_n^{(p)}=\langle\phi_n|\psi_n^p\rangle$, with $|\psi_n^p\rangle$ being the $p$'th correction to the $n$'th eigenstate. The zeroth correction of course equals the eigenstate of the unperturbed hamiltonian: $|\psi_n^0\rangle=|\phi_n\rangle$.
My question is the following: how does one go from the above equation to this?
$$\begin{array}{r l}
E_n(\lambda)&=E_n^0+\lambda\langle\phi_n|\mathcal{H}_1|\phi_n\rangle\\
&+\lambda^2\left[\langle\phi_n|\mathcal{H}_1|\psi_n^1\rangle-\langle\phi_n|\mathcal{H}_1|\phi_n\rangle a_n^{(1)}\right]\\
&+\lambda^3\left[\langle\phi_n|\mathcal{H}_1|\psi_n^2\rangle-\langle\phi_n|\mathcal{H}_1|\psi_n^1\rangle a_n^{(1)}-\langle\phi_n|\mathcal{H}_1|\phi_n\rangle a_n^{(2)}\right]+\dots
\end{array}$$
The book I'm working with tells me this is done by "Expanding this expression in powers of $\lambda$", but I can't recognize the procedure. Of course the first term $E_n^0$ is of order $\lambda^0$, and the second term $\lambda\langle\phi_n|\mathcal{H}_1|\phi_n\rangle$ is of order $\lambda^1$, and these can be taken from the original equation right away, but I can't find out how the subtractions in the third and fourth term got there.
 A: You can work it out from the Taylor series
$$\frac{1}{1 + x} = 1 - x + x^2 - x^3 + \cdots$$
where $x = \lambda a_n^{(1)} + \lambda^2 a_n^{(2)} + \cdots$. Each term can then be expanded in a power series in $\lambda$:
$$\begin{align}
-x &= -\lambda a_n^{(1)} - \lambda^2 a_n^{(2)} - \lambda^3 a_n^{(3)} - \cdots \\
x^2 &= \lambda^2 \bigl(a_n^{(1)}\bigr)^2 + 2\lambda^3 a_n^{(1)}a_n^{(2)} + \cdots \\
-x^3 &= -\lambda^3 \bigl(a_n^{(1)}\bigr)^3 - \cdots
\end{align}$$
You can then add these up term-by-term in $\lambda$:
$$\begin{align}\frac{1}{1 + \lambda a_n^{(1)} + \lambda^2 a_n^{(2)} + \cdots} \\ = 1 - \lambda a_n^{(1)} + & \lambda^2\Bigl[-a_n^{(2)} + \bigl(a_n^{(1)}\bigr)^2\Bigr] + \lambda^3\Bigl[-a_n^{(3)} + 2a_n^{(1)}a_n^{(2)} - \bigl(a_n^{(1)}\bigr)^3\Bigr] + \cdots\end{align}$$
and then multiply this by the series in the numerator ($\lambda\langle\phi_n\rvert\mathcal{H}_1\lvert\phi_n\rangle + \cdots$)to get
$$\begin{align}
  &\lambda\langle\phi_n\rvert\mathcal{H}_1\lvert\phi_n\rangle \\
+ &\lambda^2\Bigl[\langle\phi_n\rvert\mathcal{H}_1\lvert\psi_n^1\rangle - \langle\phi_n\rvert\mathcal{H}_1\lvert\phi_n\rangle a_n^{(1)}\Bigr] \\
+ &\lambda^3\biggl(\langle\phi_n\rvert\mathcal{H}_1\lvert\psi_n^2\rangle - \langle\phi_n\rvert\mathcal{H}_1\lvert\psi_n^1\rangle a_n^{(1)} + \langle\phi_n\rvert\mathcal{H}_1\lvert\phi_n\rangle\Bigl[-a_n^{(2)} + \bigl(a_n^{(1)}\bigr)^2\Bigr]\biggr) \\
+ &\cdots
\end{align}$$
Note that in the expression as you wrote it in the question, there is a term missing in the coefficient of $\lambda^3$.
I'm sure you can tell that calculating additional higher-order terms becomes increasingly tedious, but it's just straightforward series multiplication. There's nothing particularly complicated about it.
