2.1.69 Problem 69

Solved using first_order_ode_special_form_ID_1
Maple
Mathematica
Sympy

Internal problem ID [10327]
Book : First order enumerated odes
Section : section 1
Problem number : 69
Date solved : Thursday, November 27, 2025 at 10:34:14 AM
CAS classification : [[_1st_order, `_with_symmetry_[F(x),G(x)]`]]

Solved using first_order_ode_special_form_ID_1

Time used: 0.194 (sec)

Solve

\begin{align*} y^{\prime }&=x \,{\mathrm e}^{x +y}+\sin \left (x \right ) \\ \end{align*}
Writing the ode as
\begin{align*} y^{\prime } &= x \,{\mathrm e}^{x +y}+\sin \left (x \right )\tag {1} \end{align*}

And using the substitution \(u={\mathrm e}^{-y}\) then

\begin{align*} u' &= -y^{\prime } {\mathrm e}^{-y} \end{align*}

The above shows that

\begin{align*} y^{\prime } &= -u^{\prime }\left (x \right ) {\mathrm e}^{y}\\ &= -\frac {u^{\prime }\left (x \right )}{u} \end{align*}

Substituting this in (1) gives

\begin{align*} -\frac {u^{\prime }\left (x \right )}{u}&=\frac {x \,{\mathrm e}^{x}}{u}+\sin \left (x \right ) \end{align*}

The above simplifies to

\begin{align*} -u^{\prime }\left (x \right )&={\mathrm e}^{x} x +\sin \left (x \right ) u \left (x \right )\\ u^{\prime }\left (x \right )+\sin \left (x \right ) u \left (x \right )&=-{\mathrm e}^{x} x\tag {2} \end{align*}

Now ode (2) is solved for \(u \left (x \right )\).

In canonical form a linear first order is

\begin{align*} u^{\prime }\left (x \right ) + q(x)u \left (x \right ) &= p(x) \end{align*}

Comparing the above to the given ode shows that

\begin{align*} q(x) &=\sin \left (x \right )\\ p(x) &=-{\mathrm e}^{x} x \end{align*}

The integrating factor \(\mu \) is

\begin{align*} \mu &= e^{\int {q\,dx}}\\ &= {\mathrm e}^{\int \sin \left (x \right )d x}\\ &= {\mathrm e}^{-\cos \left (x \right )} \end{align*}

The ode becomes

\begin{align*} \frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}}\left ( \mu u\right ) &= \mu p \\ \frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}}\left ( \mu u\right ) &= \left (\mu \right ) \left (-{\mathrm e}^{x} x\right ) \\ \frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}} \left (u \,{\mathrm e}^{-\cos \left (x \right )}\right ) &= \left ({\mathrm e}^{-\cos \left (x \right )}\right ) \left (-{\mathrm e}^{x} x\right ) \\ \mathrm {d} \left (u \,{\mathrm e}^{-\cos \left (x \right )}\right ) &= \left (-{\mathrm e}^{x} x \,{\mathrm e}^{-\cos \left (x \right )}\right )\, \mathrm {d} x \\ \end{align*}
Integrating gives
\begin{align*} u \,{\mathrm e}^{-\cos \left (x \right )}&= \int {-{\mathrm e}^{x} x \,{\mathrm e}^{-\cos \left (x \right )} \,dx} \\ &=\int -{\mathrm e}^{x} x \,{\mathrm e}^{-\cos \left (x \right )}d x + c_1 \end{align*}

Dividing throughout by the integrating factor \({\mathrm e}^{-\cos \left (x \right )}\) gives the final solution

\[ u \left (x \right ) = {\mathrm e}^{\cos \left (x \right )} \left (\int -{\mathrm e}^{x} x \,{\mathrm e}^{-\cos \left (x \right )}d x +c_1 \right ) \]
Substituting the solution found for \(u \left (x \right )\) in \(u={\mathrm e}^{-y}\) gives
\begin{align*} {\mathrm e}^{-y} = {\mathrm e}^{\cos \left (x \right )} \left (\int -{\mathrm e}^{x} x \,{\mathrm e}^{-\cos \left (x \right )}d x +c_1 \right ) \end{align*}

Solving for \(y\) gives

\begin{align*} y &= -\ln \left (-\int {\mathrm e}^{x} x \,{\mathrm e}^{-\cos \left (x \right )}d x +c_1 \right )-\cos \left (x \right ) \\ \end{align*}
Figure 2.79: Slope field \(y^{\prime } = x \,{\mathrm e}^{x +y}+\sin \left (x \right )\)

Summary of solutions found

\begin{align*} y &= -\ln \left (-\int {\mathrm e}^{x} x \,{\mathrm e}^{-\cos \left (x \right )}d x +c_1 \right )-\cos \left (x \right ) \\ \end{align*}
Maple. Time used: 0.010 (sec). Leaf size: 29
ode:=diff(y(x),x) = x*exp(x+y(x))+sin(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = -\cos \left (x \right )-\ln \left (-c_1 -\int x \,{\mathrm e}^{x -\cos \left (x \right )}d x \right ) \]

Maple trace

Methods for first order ODEs: 
--- Trying classification methods --- 
trying a quadrature 
trying 1st order linear 
trying Bernoulli 
trying separable 
trying inverse linear 
trying homogeneous types: 
trying Chini 
differential order: 1; looking for linear symmetries 
trying exact 
Looking for potential symmetries 
trying inverse_Riccati 
trying an equivalence to an Abel ODE 
differential order: 1; trying a linearization to 2nd order 
--- trying a change of variables {x -> y(x), y(x) -> x} 
differential order: 1; trying a linearization to 2nd order 
trying 1st order ODE linearizable_by_differentiation 
--- Trying Lie symmetry methods, 1st order --- 
   -> Computing symmetries using: way = 3 
   -> Computing symmetries using: way = 4 
   -> Computing symmetries using: way = 5 
trying symmetry patterns for 1st order ODEs 
-> trying a symmetry pattern of the form [F(x)*G(y), 0] 
-> trying a symmetry pattern of the form [0, F(x)*G(y)] 
<- symmetry pattern of the form [0, F(x)*G(y)] successful
 

Maple step by step

\[ \begin {array}{lll} & {} & \textrm {Let's solve}\hspace {3pt} \\ {} & {} & \frac {d}{d x}y \left (x \right )=x \,{\mathrm e}^{x +y \left (x \right )}+\sin \left (x \right ) \\ \bullet & {} & \textrm {Highest derivative means the order of the ODE is}\hspace {3pt} 1 \\ {} & {} & \frac {d}{d x}y \left (x \right ) \\ \bullet & {} & \textrm {Solve for the highest derivative}\hspace {3pt} \\ {} & {} & \frac {d}{d x}y \left (x \right )=x \,{\mathrm e}^{x +y \left (x \right )}+\sin \left (x \right ) \end {array} \]
Mathematica. Time used: 0.282 (sec). Leaf size: 150
ode=D[y[x],x]==x*Exp[x+y[x]]+Sin[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ \text {Solve}\left [\int _1^x\left (-\exp \left (K[2]-\int _1^{K[2]}-\sin (K[1])dK[1]\right ) K[2]-\exp \left (-y(x)-\int _1^{K[2]}-\sin (K[1])dK[1]\right ) \sin (K[2])\right )dK[2]+\int _1^{y(x)}-\exp \left (-K[3]-\int _1^x-\sin (K[1])dK[1]\right ) \left (\exp \left (K[3]+\int _1^x-\sin (K[1])dK[1]\right ) \int _1^x\exp \left (-K[3]-\int _1^{K[2]}-\sin (K[1])dK[1]\right ) \sin (K[2])dK[2]-1\right )dK[3]=c_1,y(x)\right ] \]
Sympy. Time used: 10.213 (sec). Leaf size: 24
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x*exp(x + y(x)) - sin(x) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \log {\left (\frac {e^{- \cos {\left (x \right )}}}{C_{1} - \int x e^{x} e^{- \cos {\left (x \right )}}\, dx} \right )} \]