differential equations I am trying to work through an example from Jordan and Smiths book Nonlinear Ordinary Differential Equations. It's example $6.1$ on page $195$. The question reads: 

Obtain an approximate solution of the family of equations $x^{\prime\prime} + x = ex^3$
  with $x(e, 0) = 1$,  $x^{\prime}(e,0) = 0$ and error $O(e^3)$ uniformly on $t \geq 0$, by the method of coordinate pertubation.

This what I have so far: $x_0^{\prime\prime} + x_0 = 0$ so we get $x_0 = A_0\cos t + B_0\sin t$.
From the conditions given: $x_0(0) = 1$ and $x^{\prime}_0(0) = 0$, so we have $x_0 = \cos t$.
The second equation is $x^{\prime\prime}_1 + x_1 = x_0^3$ which becomes $x_1 + x_1 = \cos^3 t$, so $x^{\prime\prime}_1 + x_1 = \frac{3}{4}\cos t + \frac{1}{4}\cos 3t$.
Now I assume $x_1 = A\cos t + B\cos 3t$, so $x^{\prime}_1 = -A\sin t - 3B\sin 3t$, and $\ddot{x}_1 = -A\cos t - 9B\cos 3t$.
Therefore $\ddot{x}_1 + x_1 = -8B\cos 3t = \frac{3}{4}\cos t + \frac{1}{4}\cos 3t$, hence $-8B = \frac{1}{4}$, so $B = \frac{-1}{32}$ which gives me $x_1 = A\cos t - \frac{1}{32}\cos 3t$.
Using this and the condition that $x_0(0) = 0$ gives me $A = \frac{1}{32}$. However the solution in the book contains another term: $\frac{3}{8}t\sin t$. I don't know how to get this term. Could someone please help.
 A: Well, as you can see in the book, proposing a regular perturbation
$$
x(t) = x_0(t) + \varepsilon x_1(t) + \varepsilon^2 x_2(t) + ...
$$
we have
$$
x_0'' + \varepsilon x_1 '' + \varepsilon^2 x_2 '' + ... + x_0 + \varepsilon x_1 + \varepsilon^2 x_2 + ... = \varepsilon (x_0 + \varepsilon x_1 + ... )^3
$$
and 
$$
(x_0 + \varepsilon x_1 + ... )^3 = x_0^3 + 3 \varepsilon x_0^2 x_1 + \varepsilon^2 (3 x_0 x_1^2 + 3 x_0^2 x_2) + ...
$$
then
\begin{align}
O\big(1):& &x_0'' + x_0 &= 0\\
O(\varepsilon):& &x_1'' + x_1 &= x_0^3\\
O(\varepsilon^2):& &x_2'' + x_2 &= 3 x_0^2 x_1\\
\vdots\quad
\end{align}
Finally, the initial condition is $O(1)$, meaning $x_0(0) = 1$, $x_0'(0) = 0$, and $$x_1(0) = x_1'(0) = x_2(0) = x_2'(0) = \ldots = 0.$$
Combining all this information,
\begin{align}
x_0(t) &= \cos(t) \\
x_1(t) &= \tfrac{1}{32} \big(\cos(t) - \cos(3 t)\big) + \tfrac{3}{8} t \sin(t) \\
x_2(t) &= \tfrac{1}{1024}\big(23 \cos(t) - 24 \cos(3 t) + \cos(5 t)\big) + \tfrac{3 t}{256}\big(8 \sin(t) - 3 \sin(3 t)\big) - \tfrac{9 t^2}{128} \cos(t)
\end{align}
and we have constructed the approximation $$x(t) = x_0(t) + \varepsilon x_1(t) + \varepsilon^2 x_2(t) + O(\varepsilon^3).$$
