# Solving $\begin{bmatrix} \dot{x_1}\\\dot{x_2} \end{bmatrix} = \begin{bmatrix} -x_1\\x_2+x_1^2 \end{bmatrix}$

In my reference book, Lawrence Perko's Differential Equations, the following nonlinear system of differential equations

$$\begin{bmatrix} \dot{x_1}\\\dot{x_2} \end{bmatrix}=\begin{bmatrix} -x_1\\x_2+x_1^2 \end{bmatrix}$$

with initial condition $$c = (c_1, c_2)$$ has the following solution

$$\begin{bmatrix} c_1e^{-t}\\ c_2e^t+\frac{c_1^2}{3}(e^t-e^{-2t}) \end{bmatrix}$$

I understand that $$x_1 = c_1 e^{-t}$$ can be obtained by separating variables. After that, if we substitute that in second equation, it becomes:

\begin{align} \dot{x_2}&=x_2+(c_1e^{-t})^2 \\ \dot{x_2}-x_2&=c_1^2e^{-2t}\\ e^{-t}\dot{x_2}-e^{-t}x_2 &=c_1^2e^{-3t}\\ \frac{\mathrm{d}(e^{-t}x_2) }{\mathrm{d} t}&=c_1^2e^{-3t}\\ \therefore e^{-t}x_2&=\int c_1^2e^{-3t}dt+c_2 \end{align}

But from this I don't see a way to obtain the given solution. Help would be appreciated

By evaluating the integral $$e^{-t}x_2(t)=c_1^2\int e^{-3t}\mathrm dt+c_2=\frac{-c_1^2}{3}e^{-3t}+c_2+C$$ where $$C$$ is an integration constant. Moving the exponential over to solve for $$x_2$$, we have $$x_2(t)=\frac{-c_1^2}{3}e^{-2t}+e^{t}c_2+Ce^{t}$$ Plugging in $$x_2(0)=c_2$$ yields the solution.