5.48 problem 47

5.48.1 Solved using Lie symmetry for first order ode
5.48.2 Solved as first order ode of type Riccati
5.48.3 Maple step by step solution
5.48.4 Maple trace
5.48.5 Maple dsolve solution
5.48.6 Mathematica DSolve solution

Internal problem ID [1672]
Book : Elementary differential equations with boundary value problems. William F. Trench. Brooks/Cole 2001
Section : Chapter 2, First order equations. Transformation of Nonlinear Equations into Separable Equations. Section 2.4 Page 68
Problem number : 47
Date solved : Thursday, October 17, 2024 at 11:42:50 AM
CAS classification : [[_1st_order, _with_linear_symmetries], _Riccati]

Solve

\begin{align*} y^{\prime }&=y^{2} {\mathrm e}^{-x}+4 y+2 \,{\mathrm e}^{x} \end{align*}

5.48.1 Solved using Lie symmetry for first order ode

Time used: 0.792 (sec)

Writing the ode as

\begin{align*} y^{\prime }&=y^{2} {\mathrm e}^{-x}+4 y +2 \,{\mathrm e}^{x}\\ y^{\prime }&= \omega \left ( x,y\right ) \end{align*}

The condition of Lie symmetry is the linearized PDE given by

\begin{align*} \eta _{x}+\omega \left ( \eta _{y}-\xi _{x}\right ) -\omega ^{2}\xi _{y}-\omega _{x}\xi -\omega _{y}\eta =0\tag {A} \end{align*}

To determine \(\xi ,\eta \) then (A) is solved using ansatz. Making bivariate polynomials of degree 1 to use as anstaz gives

\begin{align*} \tag{1E} \xi &= x a_{2}+y a_{3}+a_{1} \\ \tag{2E} \eta &= x b_{2}+y b_{3}+b_{1} \\ \end{align*}

Where the unknown coefficients are

\[ \{a_{1}, a_{2}, a_{3}, b_{1}, b_{2}, b_{3}\} \]

Substituting equations (1E,2E) and \(\omega \) into (A) gives

\begin{equation} \tag{5E} b_{2}+\left (y^{2} {\mathrm e}^{-x}+4 y +2 \,{\mathrm e}^{x}\right ) \left (b_{3}-a_{2}\right )-\left (y^{2} {\mathrm e}^{-x}+4 y +2 \,{\mathrm e}^{x}\right )^{2} a_{3}-\left (-y^{2} {\mathrm e}^{-x}+2 \,{\mathrm e}^{x}\right ) \left (x a_{2}+y a_{3}+a_{1}\right )-\left (2 \,{\mathrm e}^{-x} y +4\right ) \left (x b_{2}+y b_{3}+b_{1}\right ) = 0 \end{equation}

Putting the above in normal form gives

\[ -{\mathrm e}^{-2 x} y^{4} a_{3}-4 \,{\mathrm e}^{-x} {\mathrm e}^{x} y^{2} a_{3}+{\mathrm e}^{-x} x \,y^{2} a_{2}-7 \,{\mathrm e}^{-x} y^{3} a_{3}-2 \,{\mathrm e}^{-x} x y b_{2}+{\mathrm e}^{-x} y^{2} a_{1}-{\mathrm e}^{-x} y^{2} a_{2}-{\mathrm e}^{-x} y^{2} b_{3}-2 \,{\mathrm e}^{-x} y b_{1}-4 \,{\mathrm e}^{2 x} a_{3}-2 \,{\mathrm e}^{x} x a_{2}-18 \,{\mathrm e}^{x} y a_{3}-16 y^{2} a_{3}-2 \,{\mathrm e}^{x} a_{1}-2 \,{\mathrm e}^{x} a_{2}+2 \,{\mathrm e}^{x} b_{3}-4 x b_{2}-4 y a_{2}-4 b_{1}+b_{2} = 0 \]

Setting the numerator to zero gives

\begin{equation} \tag{6E} -{\mathrm e}^{-2 x} y^{4} a_{3}-4 \,{\mathrm e}^{-x} {\mathrm e}^{x} y^{2} a_{3}+{\mathrm e}^{-x} x \,y^{2} a_{2}-7 \,{\mathrm e}^{-x} y^{3} a_{3}-2 \,{\mathrm e}^{-x} x y b_{2}+{\mathrm e}^{-x} y^{2} a_{1}-{\mathrm e}^{-x} y^{2} a_{2}-{\mathrm e}^{-x} y^{2} b_{3}-2 \,{\mathrm e}^{-x} y b_{1}-4 \,{\mathrm e}^{2 x} a_{3}-2 \,{\mathrm e}^{x} x a_{2}-18 \,{\mathrm e}^{x} y a_{3}-16 y^{2} a_{3}-2 \,{\mathrm e}^{x} a_{1}-2 \,{\mathrm e}^{x} a_{2}+2 \,{\mathrm e}^{x} b_{3}-4 x b_{2}-4 y a_{2}-4 b_{1}+b_{2} = 0 \end{equation}

Simplifying the above gives

\begin{equation} \tag{6E} -{\mathrm e}^{-2 x} y^{4} a_{3}-20 y^{2} a_{3}+{\mathrm e}^{-x} x \,y^{2} a_{2}-7 \,{\mathrm e}^{-x} y^{3} a_{3}-2 \,{\mathrm e}^{-x} x y b_{2}+{\mathrm e}^{-x} y^{2} a_{1}-{\mathrm e}^{-x} y^{2} a_{2}-{\mathrm e}^{-x} y^{2} b_{3}-2 \,{\mathrm e}^{-x} y b_{1}-4 \,{\mathrm e}^{2 x} a_{3}-2 \,{\mathrm e}^{x} x a_{2}-18 \,{\mathrm e}^{x} y a_{3}-2 \,{\mathrm e}^{x} a_{1}-2 \,{\mathrm e}^{x} a_{2}+2 \,{\mathrm e}^{x} b_{3}-4 x b_{2}-4 y a_{2}-4 b_{1}+b_{2} = 0 \end{equation}

Looking at the above PDE shows the following are all the terms with \(\{x, y\}\) in them.

\[ \{x, y, {\mathrm e}^{x}, {\mathrm e}^{-2 x}, {\mathrm e}^{-x}, {\mathrm e}^{2 x}\} \]

The following substitution is now made to be able to collect on all terms with \(\{x, y\}\) in them

\[ \{x = v_{1}, y = v_{2}, {\mathrm e}^{x} = v_{3}, {\mathrm e}^{-2 x} = v_{4}, {\mathrm e}^{-x} = v_{5}, {\mathrm e}^{2 x} = v_{6}\} \]

The above PDE (6E) now becomes

\begin{equation} \tag{7E} -v_{4} v_{2}^{4} a_{3}+v_{5} v_{1} v_{2}^{2} a_{2}-7 v_{5} v_{2}^{3} a_{3}+v_{5} v_{2}^{2} a_{1}-v_{5} v_{2}^{2} a_{2}-2 v_{5} v_{1} v_{2} b_{2}-v_{5} v_{2}^{2} b_{3}-2 v_{3} v_{1} a_{2}-20 v_{2}^{2} a_{3}-18 v_{3} v_{2} a_{3}-2 v_{5} v_{2} b_{1}-2 v_{3} a_{1}-4 v_{2} a_{2}-2 v_{3} a_{2}-4 v_{6} a_{3}-4 v_{1} b_{2}+2 v_{3} b_{3}-4 b_{1}+b_{2} = 0 \end{equation}

Collecting the above on the terms \(v_i\) introduced, and these are

\[ \{v_{1}, v_{2}, v_{3}, v_{4}, v_{5}, v_{6}\} \]

Equation (7E) now becomes

\begin{equation} \tag{8E} v_{5} v_{1} v_{2}^{2} a_{2}-2 v_{5} v_{1} v_{2} b_{2}-2 v_{3} v_{1} a_{2}-4 v_{1} b_{2}-v_{4} v_{2}^{4} a_{3}-7 v_{5} v_{2}^{3} a_{3}+\left (a_{1}-a_{2}-b_{3}\right ) v_{2}^{2} v_{5}-20 v_{2}^{2} a_{3}-18 v_{3} v_{2} a_{3}-2 v_{5} v_{2} b_{1}-4 v_{2} a_{2}+\left (-2 a_{1}-2 a_{2}+2 b_{3}\right ) v_{3}-4 v_{6} a_{3}-4 b_{1}+b_{2} = 0 \end{equation}

Setting each coefficients in (8E) to zero gives the following equations to solve

\begin{align*} a_{2}&=0\\ -4 a_{2}&=0\\ -2 a_{2}&=0\\ -20 a_{3}&=0\\ -18 a_{3}&=0\\ -7 a_{3}&=0\\ -4 a_{3}&=0\\ -a_{3}&=0\\ -2 b_{1}&=0\\ -4 b_{2}&=0\\ -2 b_{2}&=0\\ -4 b_{1}+b_{2}&=0\\ -2 a_{1}-2 a_{2}+2 b_{3}&=0\\ a_{1}-a_{2}-b_{3}&=0 \end{align*}

Solving the above equations for the unknowns gives

\begin{align*} a_{1}&=b_{3}\\ a_{2}&=0\\ a_{3}&=0\\ b_{1}&=0\\ b_{2}&=0\\ b_{3}&=b_{3} \end{align*}

Substituting the above solution in the anstaz (1E,2E) (using \(1\) as arbitrary value for any unknown in the RHS) gives

\begin{align*} \xi &= 1 \\ \eta &= y \\ \end{align*}

Shifting is now applied to make \(\xi =0\) in order to simplify the rest of the computation

\begin{align*} \eta &= \eta - \omega \left (x,y\right ) \xi \\ &= y - \left (y^{2} {\mathrm e}^{-x}+4 y +2 \,{\mathrm e}^{x}\right ) \left (1\right ) \\ &= -3 y -y^{2} {\mathrm e}^{-x}-2 \,{\mathrm e}^{x}\\ \xi &= 0 \end{align*}

The next step is to determine the canonical coordinates \(R,S\). The canonical coordinates map \(\left ( x,y\right ) \to \left ( R,S \right )\) where \(\left ( R,S \right )\) are the canonical coordinates which make the original ode become a quadrature and hence solved by integration.

The characteristic pde which is used to find the canonical coordinates is

\begin{align*} \frac {d x}{\xi } &= \frac {d y}{\eta } = dS \tag {1} \end{align*}

The above comes from the requirements that \(\left ( \xi \frac {\partial }{\partial x} + \eta \frac {\partial }{\partial y}\right ) S(x,y) = 1\). Starting with the first pair of ode’s in (1) gives an ode to solve for the independent variable \(R\) in the canonical coordinates, where \(S(R)\). Since \(\xi =0\) then in this special case

\begin{align*} R = x \end{align*}

\(S\) is found from

\begin{align*} S &= \int { \frac {1}{\eta }} dy\\ &= \int { \frac {1}{-3 y -y^{2} {\mathrm e}^{-x}-2 \,{\mathrm e}^{x}}} dy \end{align*}

Which results in

\begin{align*} S&= -\frac {2 \,{\mathrm e}^{x} \arctan \left (\frac {2 y +3 \,{\mathrm e}^{x}}{\sqrt {-{\mathrm e}^{2 x}}}\right )}{\sqrt {-{\mathrm e}^{2 x}}} \end{align*}

Now that \(R,S\) are found, we need to setup the ode in these coordinates. This is done by evaluating

\begin{align*} \frac {dS}{dR} &= \frac { S_{x} + \omega (x,y) S_{y} }{ R_{x} + \omega (x,y) R_{y} }\tag {2} \end{align*}

Where in the above \(R_{x},R_{y},S_{x},S_{y}\) are all partial derivatives and \(\omega (x,y)\) is the right hand side of the original ode given by

\begin{align*} \omega (x,y) &= y^{2} {\mathrm e}^{-x}+4 y +2 \,{\mathrm e}^{x} \end{align*}

Evaluating all the partial derivatives gives

\begin{align*} R_{x} &= 1\\ R_{y} &= 0\\ S_{x} &= \frac {{\mathrm e}^{-x} y}{{\mathrm e}^{-2 x} y^{2}+3 \,{\mathrm e}^{-x} y +2}\\ S_{y} &= -\frac {{\mathrm e}^{-x}}{{\mathrm e}^{-2 x} y^{2}+3 \,{\mathrm e}^{-x} y +2} \end{align*}

Substituting all the above in (2) and simplifying gives the ode in canonical coordinates.

\begin{align*} \frac {dS}{dR} &= -1\tag {2A} \end{align*}

We now need to express the RHS as function of \(R\) only. This is done by solving for \(x,y\) in terms of \(R,S\) from the result obtained earlier and simplifying. This gives

\begin{align*} \frac {dS}{dR} &= -1 \end{align*}

The above is a quadrature ode. This is the whole point of Lie symmetry method. It converts an ode, no matter how complicated it is, to one that can be solved by integration when the ode is in the canonical coordiates \(R,S\).

Since the ode has the form \(\frac {d}{d R}S \left (R \right )=f(R)\), then we only need to integrate \(f(R)\).

\begin{align*} \int {dS} &= \int {-1\, dR}\\ S \left (R \right ) &= -R + c_2 \end{align*}

To complete the solution, we just need to transform the above back to \(x,y\) coordinates. This results in

\begin{align*} 2 \,\operatorname {arctanh}\left (2 \,{\mathrm e}^{-x} y+3\right ) = -x +c_2 \end{align*}

Which gives

\begin{align*} y = \frac {\left (-3+\tanh \left (-\frac {x}{2}+\frac {c_2}{2}\right )\right ) {\mathrm e}^{x}}{2} \end{align*}

The following diagram shows solution curves of the original ode and how they transform in the canonical coordinates space using the mapping shown.

Original ode in \(x,y\) coordinates

Canonical coordinates transformation

ODE in canonical coordinates \((R,S)\)

\( \frac {dy}{dx} = y^{2} {\mathrm e}^{-x}+4 y +2 \,{\mathrm e}^{x}\)

\( \frac {d S}{d R} = -1\)

\(\!\begin {aligned} R&= x\\ S&= 2 \,\operatorname {arctanh}\left (2 \,{\mathrm e}^{-x} y +3\right ) \end {aligned} \)

Figure 424: Slope field plot
\(y^{\prime } = y^{2} {\mathrm e}^{-x}+4 y+2 \,{\mathrm e}^{x}\)
5.48.2 Solved as first order ode of type Riccati

Time used: 0.148 (sec)

In canonical form the ODE is

\begin{align*} y' &= F(x,y)\\ &= y^{2} {\mathrm e}^{-x}+4 y +2 \,{\mathrm e}^{x} \end{align*}

This is a Riccati ODE. Comparing the ODE to solve

\[ y' = y^{2} {\mathrm e}^{-x}+4 y +2 \,{\mathrm e}^{x} \]

With Riccati ODE standard form

\[ y' = f_0(x)+ f_1(x)y+f_2(x)y^{2} \]

Shows that \(f_0(x)=2 \,{\mathrm e}^{x}\), \(f_1(x)=4\) and \(f_2(x)={\mathrm e}^{-x}\). Let

\begin{align*} y &= \frac {-u'}{f_2 u} \\ &= \frac {-u'}{u \,{\mathrm e}^{-x}} \tag {1} \end{align*}

Using the above substitution in the given ODE results (after some simplification)in a second order ODE to solve for \(u(x)\) which is

\begin{align*} f_2 u''(x) -\left ( f_2' + f_1 f_2 \right ) u'(x) + f_2^2 f_0 u(x) &= 0 \tag {2} \end{align*}

But

\begin{align*} f_2' &=-{\mathrm e}^{-x}\\ f_1 f_2 &=4 \,{\mathrm e}^{-x}\\ f_2^2 f_0 &=2 \,{\mathrm e}^{-2 x} {\mathrm e}^{x} \end{align*}

Substituting the above terms back in equation (2) gives

\begin{align*} {\mathrm e}^{-x} u^{\prime \prime }\left (x \right )-3 \,{\mathrm e}^{-x} u^{\prime }\left (x \right )+2 \,{\mathrm e}^{-2 x} {\mathrm e}^{x} u \left (x \right ) = 0 \end{align*}

An ode of the form

\begin{align*} p \left (x \right ) \left (\frac {d^{2}u}{d x^{2}}\right )+q \left (x \right ) \left (\frac {d u}{d x}\right )+r \left (x \right ) u&=s \left (x \right ) \end{align*}

is exact if

\begin{align*} p''(x) - q'(x) + r(x) &= 0 \tag {1} \end{align*}

For the given ode we have

\begin{align*} p(x) &= {\mathrm e}^{-x}\\ q(x) &= -3 \,{\mathrm e}^{-x}\\ r(x) &= 2 \,{\mathrm e}^{-x}\\ s(x) &= 0 \end{align*}

Hence

\begin{align*} p''(x) &= {\mathrm e}^{-x}\\ q'(x) &= 3 \,{\mathrm e}^{-x} \end{align*}

Therefore (1) becomes

\begin{align*} {\mathrm e}^{-x}- \left (3 \,{\mathrm e}^{-x}\right ) + \left (2 \,{\mathrm e}^{-x}\right )&=0 \end{align*}

Hence the ode is exact. Since we now know the ode is exact, it can be written as

\begin{align*} \left (p \left (x \right ) \left (\frac {d u}{d x}\right )+\left (q \left (x \right )-\frac {d}{d x}p \left (x \right )\right ) u\right )' &= s(x) \end{align*}

Integrating gives

\begin{align*} p \left (x \right ) \left (\frac {d u}{d x}\right )+\left (q \left (x \right )-\frac {d}{d x}p \left (x \right )\right ) u&=\int {s \left (x \right )\, dx} \end{align*}

Substituting the above values for \(p,q,r,s\) gives

\begin{align*} {\mathrm e}^{-x} \left (\frac {d u}{d x}\right )-2 \,{\mathrm e}^{-x} u&=c_1 \end{align*}

We now have a first order ode to solve which is

\begin{align*} {\mathrm e}^{-x} \left (\frac {d u}{d x}\right )-2 \,{\mathrm e}^{-x} u = c_1 \end{align*}

In canonical form a linear first order is

\begin{align*} \frac {d u}{d x} + q(x)u &= p(x) \end{align*}

Comparing the above to the given ode shows that

\begin{align*} q(x) &=-2\\ p(x) &=c_1 \,{\mathrm e}^{x} \end{align*}

The integrating factor \(\mu \) is

\begin{align*} \mu &= e^{\int {q\,dx}}\\ &= {\mathrm e}^{\int \left (-2\right )d x}\\ &= {\mathrm e}^{-2 x} \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 (c_1 \,{\mathrm e}^{x}\right ) \\ \frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}x}} \left (u \,{\mathrm e}^{-2 x}\right ) &= \left ({\mathrm e}^{-2 x}\right ) \left (c_1 \,{\mathrm e}^{x}\right ) \\ \mathrm {d} \left (u \,{\mathrm e}^{-2 x}\right ) &= \left (c_1 \,{\mathrm e}^{x} {\mathrm e}^{-2 x}\right )\, \mathrm {d} x \\ \end{align*}

Integrating gives

\begin{align*} u \,{\mathrm e}^{-2 x}&= \int {c_1 \,{\mathrm e}^{x} {\mathrm e}^{-2 x} \,dx} \\ &=-c_1 \,{\mathrm e}^{x} {\mathrm e}^{-2 x} + c_2 \end{align*}

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

\[ u = -{\mathrm e}^{x} \left (-c_2 \,{\mathrm e}^{x}+c_1 \right ) \]

Will add steps showing solving for IC soon.

Taking derivative gives

\[ u^{\prime }\left (x \right ) = -{\mathrm e}^{x} \left (-c_2 \,{\mathrm e}^{x}+c_1 \right )+{\mathrm e}^{2 x} c_2 \]

Doing change of constants, the solution becomes

\[ y = \frac {\left (-{\mathrm e}^{x} \left (-{\mathrm e}^{x}+c_3 \right )+{\mathrm e}^{2 x}\right ) {\mathrm e}^{x} {\mathrm e}^{-x}}{-{\mathrm e}^{x}+c_3} \]
Figure 425: Slope field plot
\(y^{\prime } = y^{2} {\mathrm e}^{-x}+4 y+2 \,{\mathrm e}^{x}\)
5.48.3 Maple step by step solution
\[ \begin {array}{lll} & {} & \textrm {Let's solve}\hspace {3pt} \\ {} & {} & \frac {d}{d x}y \left (x \right )=y \left (x \right )^{2} {\mathrm e}^{-x}+4 y \left (x \right )+2 \,{\mathrm e}^{x} \\ \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 )=y \left (x \right )^{2} {\mathrm e}^{-x}+4 y \left (x \right )+2 \,{\mathrm e}^{x} \end {array} \]

5.48.4 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 
<- Chini successful`
 
5.48.5 Maple dsolve solution

Solving time : 0.157 (sec)
Leaf size : 22

dsolve(diff(y(x),x) = y(x)^2*exp(-x)+4*y(x)+2*exp(x), 
       y(x),singsol=all)
 
\[ y = -\frac {2 \,{\mathrm e}^{x} \left ({\mathrm e}^{x} c_1 -1\right )}{-2+{\mathrm e}^{x} c_1} \]
5.48.6 Mathematica DSolve solution

Solving time : 0.271 (sec)
Leaf size : 30

DSolve[{D[y[x],x]==y[x]^2*Exp[-x]+4*y[x]+2*Exp[x],{}}, 
       y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to -2 e^x+\frac {1}{e^{-x}+c_1} \\ y(x)\to -2 e^x \\ \end{align*}