2.4.7 Problem 7

Solved using first_order_ode_bernoulli
Maple
Mathematica
Sympy

Internal problem ID [18487]
Book : Elementary Differential Equations. By Thornton C. Fry. D Van Nostrand. NY. First Edition (1929)
Section : Chapter IV. Methods of solution: First order equations. section 31. Problems at page 85
Problem number : 7
Date solved : Monday, March 31, 2025 at 05:37:15 PM
CAS classification : [_Bernoulli]

Solved using first_order_ode_bernoulli

Time used: 0.246 (sec)

Solve

ycos(x)y=y2cos(x)(1sin(x))

In canonical form, the ODE is

y=F(x,y)=y(ycos(x)sin(x)ycos(x)+1)cos(x)

This is a Bernoulli ODE.

(1)y=(1cos(x))y+(cos(x)sin(x)cos(x)cos(x))y2

The standard Bernoulli ODE has the form

(2)y=f0(x)y+f1(x)yn

Comparing this to (1) shows that

f0=1cos(x)f1=cos(x)sin(x)cos(x)cos(x)

The first step is to divide the above equation by yn which gives

(3)yyn=f0(x)y1n+f1(x)

The next step is use the substitution v=y1n in equation (3) which generates a new ODE in v(x) which will be linear and can be easily solved using an integrating factor. Backsubstitution then gives the solution y(x) which is what we want.

This method is now applied to the ODE at hand. Comparing the ODE (1) With (2) Shows that

f0(x)=1cos(x)f1(x)=cos(x)sin(x)cos(x)cos(x)n=2

Dividing both sides of ODE (1) by yn=y2 gives

(4)y1y2=1cos(x)y+cos(x)sin(x)cos(x)cos(x)

Let

v=y1n(5)=1y

Taking derivative of equation (5) w.r.t x gives

(6)v=1y2y

Substituting equations (5) and (6) into equation (4) gives

v(x)=v(x)cos(x)+cos(x)sin(x)cos(x)cos(x)(7)v=vcos(x)cos(x)sin(x)cos(x)cos(x)

The above now is a linear ODE in v(x) which is now solved.

In canonical form a linear first order is

v(x)+q(x)v(x)=p(x)

Comparing the above to the given ode shows that

q(x)=sec(x)p(x)=1sin(x)

The integrating factor μ is

μ=eqdx=esec(x)dx=sec(x)+tan(x)

The ode becomes

ddx(μv)=μpddx(μv)=(μ)(1sin(x))ddx(v(sec(x)+tan(x)))=(sec(x)+tan(x))(1sin(x))d(v(sec(x)+tan(x)))=((1sin(x))(sec(x)+tan(x)))dx

Integrating gives

v(sec(x)+tan(x))=(1sin(x))(sec(x)+tan(x))dx=sin(x)+c1

Dividing throughout by the integrating factor sec(x)+tan(x) gives the final solution

v(x)=(sin(x)+c1)(cos(x)sin(x)+1)cos(x)+sin(x)+1

The substitution v=y1n is now used to convert the above solution back to y which results in

1y=(sin(x)+c1)(cos(x)sin(x)+1)cos(x)+sin(x)+1

Solving for y gives

y=cos(x)+sin(x)+1cos(x)sin(x)+cos(x)c1sin(x)2c1sin(x)+sin(x)+c1

Which simplifies to

y=cos(x)+sin(x)+1(sin(x)+c1)(cos(x)sin(x)+1)
Figure 2.51: Slope field ycos(x)y=y2cos(x)(1sin(x))

Summary of solutions found

y=cos(x)+sin(x)+1(sin(x)+c1)(cos(x)sin(x)+1)
Maple. Time used: 0.003 (sec). Leaf size: 27
ode:=y(x)-cos(x)*diff(y(x),x) = y(x)^2*cos(x)*(1-sin(x)); 
dsolve(ode,y(x), singsol=all);
 
y=cos(x)+sin(x)+1(sin(x)+c1)(sin(x)+cos(x)+1)

Maple trace

Methods for first order ODEs: 
--- Trying classification methods --- 
trying a quadrature 
trying 1st order linear 
trying Bernoulli 
<- Bernoulli successful
 

Maple step by step

Let’s solvey(x)cos(x)(ddxy(x))=y(x)2cos(x)(1sin(x))Highest derivative means the order of the ODE is1ddxy(x)Solve for the highest derivativeddxy(x)=y(x)+y(x)2cos(x)(1sin(x))cos(x)
Mathematica. Time used: 0.419 (sec). Leaf size: 41
ode=y[x]-Cos[x]*D[y[x],x]==y[x]^2*Cos[x]*(1-Sin[x]); 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
y(x)e2arctanh(tan(x2))cos(x)e2arctanh(tan(x2))+c1y(x)0
Sympy. Time used: 2.096 (sec). Leaf size: 39
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-(1 - sin(x))*y(x)**2*cos(x) + y(x) - cos(x)*Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
y(x)=sin(x)+1(C1sin(x)1sin(x)+1dx)sin(x)1