Using the methods of separable equations, we can rewrite this differential equation as
\begin{equation*}
\frac{dy}{y^2 - 3y - 4} = (x^2 + e^x) \ dx
\end{equation*}
and we can integrate both sides to solve. This leads to
\begin{equation*}
\int \frac{dy}{y^2 - 3y + 4} =
\int x^2 + e^x\ dx.
\end{equation*}
The right-hand side of this can be integrated normally to give
\begin{equation*}
\int x^2 + e^x\ dx = \frac{x^3}{3} + e^x + C
\end{equation*}
and the left-hand side requires partial fractions in order to integrate correctly. If you are not familiar with this technique of partial fractions, it is reviewed in
SectionΒ A.3.
Using the method of partial fractions, we want to rewrite
\begin{equation*}
\frac{1}{y^2 - 3y
- 4} = \frac{A}{y-4} + \frac{B}{y+1}
\end{equation*}
and solve for \(A\) and \(B\text{,}\) which gives
\begin{equation*}
\frac{1}{y^2 - 3y - 4} = \frac{1/5}{y-4} - \frac{1/5}{y+1}.
\end{equation*}
Therefore, we can compute the integral
\begin{align*}
\int \frac{dy}{y^2 - 3y - 4} \amp = \int
\frac{1/5}{y-4} - \frac{1/5}{y+1} dy \\
\amp = \frac{1}{5} \ln(|y-4|) - \frac{1}{5}
\ln(|y+1|) + C\text{.}
\end{align*}
Therefore, we can write the general solution as
\begin{equation*}
\frac{1}{5}
\ln{\left(\frac{|y-4|}{|y+1|} \right)} = \frac{x^3}{3} + e^x + C.
\end{equation*}
We could solve this out for \(y\) as an explicit function, but that is not necessary for a problem like this.
There are also two singular solutions here at
\(y=4\) and
\(y=-1\text{.}\) Notice that the implicit solution that we found previously is not defined at either of these values, because they involve taking the natural log of
\(0\text{,}\) which is not defined.