Finding the general solution to a system of differential equations How can I solve the following system of differential equations? I am getting confused with the constants of integration...
$$\dot{x}=2x-(2+y)e^{y}$$ 
$$\dot{y}=-y$$
I know that $y=Ce^{-t}$ and the integrating factor method for solving a linear differential equation, but it gets complicated quickly.
 A: So you're stuck on the first equation then.  Substituting your result from the second equation, we have
$$x'-2x=-(2+Ce^{-t})e^{Ce^{-t}}$$
Multiplying through by an integrating factor, we have
$$e^{-2t}x'-2e^{-2t}x=(e^{-2t}x)'=-(2+Ce^{-t})e^{Ce^{-t}-2t}$$
$$e^{-2t}x=e^{Ce^{-t}-2t}+k$$
$$x=e^{Ce^{-t}}+ke^{2t}$$
A: The way I would try and solve this one is as follows:
first, note that the equation for $\dot y$, $\dot y = -y$, is decoupled from that for $\dot x$; thus we can solve it independently of the other one.  It's simple form makes it easy to write down the solution directly:  indeed, we have
$y(t) = y_0e^{-(t - t_0)}, \tag{1}$
where $y_0 = y(t_0)$ is the value of $y$ at $t = t_0$.  We can now insert the solution for $y$ into the other equation,
$\dot{x}=2x-(2+y)e^{y}, \tag{2}$
and in doing so we obtain
$\dot x = 2x - (2 + y_0e^{-(t - t_0)})exp(y_0e^{-(t - t_0)}). \tag{3}$
Though (3) is a non-homogeneous, linear ODE for $x(t)$, and hence has a well-know integral solution, the presence of the iterated exponential function of $t$ on the right might make carrying out the integral involved a challenge.  Nevertheless, we proceed:  the general form of the solution to an equation
$\dot x = \lambda x + b(t), x(t_0) = x_0 \tag{4}$
is
$x(t) = x_0e^{\lambda(t - t_0)} + e^{\lambda(t - t_0)}\int_{t_0}^t e^{-\lambda(s - t_0)}b(s)ds, \tag{5}$
which may be readily verified by direct differentiation; googling or wiki'ing around a bit should also lead to many references with detailed explanations.  In any event, in the present case $\lambda = 2$ and $b(t) = -(2 + y_0e^{-(t - t_0)})exp(y_0e^{-(t - t_0)})$, whence 
$e^{-\lambda(s - t_0)}b(s) = -e^{-2(s - t_0)}(2 + y_0e^{-(s - t_0)})exp(y_0e^{-(s - t_0)}) = -(2 + y_0e^{-(s - t_0)})exp(-2(s - t_0) + y_0e^{-(s - t_0)}). \tag{6}$
According to (5), we need to evaluate the integral
$\int_{t_0}^t e^{-\lambda(s - t_0)}b(s)ds = -\int_{t_0}^t (2 + y_0e^{-(s - t_0)})exp(-2(s - t_0) + y_0e^{-(s - t_0)}) ds, \tag{7}$
which at first glance looks quite formidable due to the presence of the iterated exponential function.  But lo!  To our great good fortune we observe that, taking $u(s) = -2(s - t_0) + y_0e^{-(s - t_0)}$, $du = -(2 + y_0e^{-(s - t_0)})ds$, so that the integral which once appeared impossible now takes the simplest of forms
$-\int_{t_0}^t (2 + y_0e^{-(s - t_0)})exp(-2(s - t_0) + y_0e^{-(s - t_0)}) ds =  \int_{t_0}^t e^{u(s)}du = e^{u(t)} - e^{u(t_0)} = exp(-2(t - t_0) + y_0e^{-(t - t_0)}) - exp(y_0). \tag{8}$
If (8) is now inserted into (5), along with $\lambda = 2$, we obtain (after performing a few elementary algebraic maneuvers)
$x(t) = x_0e^{2(t - t_0)} - e^{y_0}e^{2(t - t_0)} + exp(y_0e^{-(t - t_0)}); \tag{9}$
if one differentiates (9) it is seen that it satisfies (2).  This is most easily accomplished by noting that (9) may be written
$x(t) = x_0e^{2(t - t_0)} + e^{2(t - t_0)}(exp(-2(t - t_0) + y_0e^{-(t - t_0)}) - e^{y_0}); \tag{10}$
I leave this verification for any interested readers.
Hope this helps.  Cheerio,
and as always,
Fiat Lux!!!
