Differential Equation $y'=x e^y + \cos x$ I am new to differential equations. I tried to find a series solution for this equation, but I don't know how to solve it.
\begin{equation}
y'=x e^y + \cos x
\\y(0)=1
\end{equation}
Actually, the problem needs the coefficient of $x^3$ in Maclaurin series solution.
 A: For a series solution, put $y = a_0 + a_1 x + a_2 x^2 + a_3 x^3 + \cdots$. Assuming the equation han an analytic solution, you can differentiate and otherwise manipulate this series at will.
Also, the standard Maclaurin expansion of $e^t$ gives
\begin{align}
e^y &= e^{a_0}e^{y-a_0} \\
&= e^{a_0}\left( 1 + (a_1 x + a_2 x^2 + \cdots) + \frac12(a_1 x + a_2 x^2 + \cdots)^2 + \cdots\right)
\end{align}
The reason why I rewrite $e^y$ as $e^{a_0}e^{y-a_0}$ is to get an argument of $\exp$ which is $0$ for $x=0$.
Keeping track of enough terms, we get
$$
e^y = e^{a_0}\left( 1 + a_1 x + \big(a_2 + \frac{a_1^2}2\big)x^2 + \big( a_3 + a_1a_2 + \frac{a_1^3}6 \big)x^3 + \cdots\right)
$$
Hence (using the Maclaurin expansion of $\cos x$),
$$
xe^y + \cos x = 1 + Ax + \big( Aa_1 - \frac12\big)x^2 + A\big( a_2 + \frac12a_1^2\big)x^3
+  \cdots$$
where $A=e^{a_0}$. On the other hand
$$y' = a_1 + 2a_2x + 3a_3x^2 + \cdots$$
and the coefficients of these two series must match. We get a system of equations, the first three being
$$
\begin{cases}
a_1 = 1 \\
A = 2a_2 \\
A a_1 - \frac12 = 3a_3
\end{cases}
$$
From these equations, $a_3 = \frac13A - \frac16$.
(The chance that I managed to write all of this with no errors is slim, however...)

Somewhat surprisingly, the differential equation can be solved explicitly. You can check that
$$y = \sin x - \ln \bigg( C - \int xe^{\sin x}\,dx \bigg)$$
solves the differential equation.
A: First, expand to first order: $y=1+ax+o(x^2)$. The diff. eq. shows
$$y'=a+o(x)=\left[o(x)\right]+\left[1+o(x)\right]\implies a=1$$
Now consider $e^y$ to the first order:
$$e^y=e^{1+x+o(x^2)}=e\cdot e^x\cdot e^{o(x^2)}=e(1+x)+o(x^2)$$
Thus to second order,
$$y'=x\left[e(1+x)+o(x^2)\right]+\left[1-\frac{x^2}{2}+o(x^4)\right]$$
Collecting terms shows $y'[x^2]=e-\frac{1}{2}$.
Thus, $$y[x^3]=\frac{2e-1}{6}$$
