ODE No. 75

\[ y'(x)-e^{x-y(x)}+e^x=0 \] Mathematica : cpu = 0.175798 (sec), leaf count = 20

DSolve[E^x - E^(x - y[x]) + Derivative[1][y][x] == 0,y[x],x]
 

\[\left \{\left \{y(x)\to \log \left (1-e^{-e^x+c_1}\right )\right \}\right \}\] Maple : cpu = 0.155 (sec), leaf count = 20

dsolve(diff(y(x),x)-exp(x-y(x))+exp(x) = 0,y(x))
 

\[y \left (x \right ) = -{\mathrm e}^{x}+\ln \left (-1+{\mathrm e}^{{\mathrm e}^{x}+c_{1}}\right )-c_{1}\]

Hand solution

\begin {align} y^{\prime } & =e^{x-y}-e^{x}\nonumber \\ y^{\prime } & =e^{x}\left ( e^{-y}-1\right ) \nonumber \\ \frac {1}{e^{-y}-1}dy & =e^{x}dx\tag {1} \end {align}

Integrating both sides. \(\int \frac {1}{e^{-y}-1}dy\). Let \(e^{-y}=u\), then \(\frac {du}{dy}=-e^{-y}=-u\). Hence \(dy=-\frac {du}{u}\), therefore the integral becomes\[ \int \frac {1}{u-1}\left ( -\frac {du}{u}\right ) =-\int \frac {1}{u\left ( u-1\right ) }du \] But \(\frac {1}{u\left ( u-1\right ) }=-\left ( \frac {1}{u}-\frac {1}{u-1}\right ) \), hence\begin {align*} -\int \frac {1}{u\left ( u-1\right ) }du & =\int \left ( \frac {1}{u}-\frac {1}{u-1}\right ) du\\ & =\ln u-\ln \left ( u-1\right ) \\ & =\ln e^{-y}-\ln \left ( e^{-y}-1\right ) \\ & =-\left ( \ln \left ( e^{-y}-1\right ) -\ln e^{-y}\right ) \end {align*}

But \(\ln x-\ln y=\ln \left ( \frac {x}{y}\right ) \) and the above becomes\begin {align*} \int \frac {1}{e^{-y}-1}dy & =-\left [ \ln \left ( \frac {e^{-y}-1}{e^{-y}}\right ) \right ] \\ & =-\ln \left ( 1-e^{y}\right ) \end {align*}

Back to (1), when we integrate both sides, and since \(\int e^{x}dx=e^{x}+C\)\begin {align*} -\ln \left ( 1-e^{y}\right ) & =e^{x}+C\\ \ln \left ( 1-e^{y}\right ) & =-e^{x}+C_{1} \end {align*}

Hence\begin {align*} 1-e^{y} & =\exp \left ( -e^{x}+C_{1}\right ) \\ e^{y} & =1-\exp \left ( -e^{x}+C_{1}\right ) \end {align*}

Taking logs\[ y=\ln \left ( 1-\exp \left ( -e^{x}+C_{1}\right ) \right ) \] Let \(e^{C_{1}}=C_{2}\) then\[ y=\ln \left ( 1-C_{2}e^{-e^{x}}\right ) \] Verification

ode:=diff(y(x),x)=exp(x-y(x))-exp(x); 
my_sol:=log(1-_C1*exp(-exp(x))); 
odetest(y(x)=my_sol,ode); 
0