2.1.23 Problem 23

Solved using first_order_ode_bernoulli
Solved using first_order_ode_exact
Maple
Mathematica
Sympy

Internal problem ID [9007]
Book : First order enumerated odes
Section : section 1
Problem number : 23
Date solved : Sunday, March 30, 2025 at 01:58:55 PM
CAS classification : [_rational, _Bernoulli]

Solved using first_order_ode_bernoulli

Time used: 0.227 (sec)

Solve

cy=ax+by2y

In canonical form, the ODE is

y=F(x,y)=by2+axyc

This is a Bernoulli ODE.

(1)y=(bc)y+(axc)1y

The standard Bernoulli ODE has the form

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

Comparing this to (1) shows that

f0=bcf1=axc

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)=bcf1(x)=axcn=1

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

(4)yy=by2c+axc

Let

v=y1n(5)=y2

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

(6)v=2yy

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

v(x)2=bv(x)c+axc(7)v=2bvc+2axc

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)=2bcp(x)=2axc

The integrating factor μ is

μ=eqdx=e2bcdx=e2bxc

The ode becomes

ddx(μv)=μpddx(μv)=(μ)(2axc)ddx(ve2bxc)=(e2bxc)(2axc)d(ve2bxc)=(2axe2bxcc)dx

Integrating gives

ve2bxc=2axe2bxccdx=(2bx+c)ae2bxc2b2+c1

Dividing throughout by the integrating factor e2bxc gives the final solution

v(x)=(2bx+c)a2b2+e2bxcc1

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

y2=(2bx+c)a2b2+e2bxcc1

Solving for y gives

y=4c1e2bxcb24abx2ac2by=4c1e2bxcb24abx2ac2b

Summary of solutions found

y=4c1e2bxcb24abx2ac2by=4c1e2bxcb24abx2ac2b
Solved using first_order_ode_exact

Time used: 0.148 (sec)

Solve

cy=ax+by2y

To solve an ode of the form

(A)M(x,y)+N(x,y)dydx=0

We assume there exists a function ϕ(x,y)=c where c is constant, that satisfies the ode. Taking derivative of ϕ w.r.t. x gives

ddxϕ(x,y)=0

Hence

(B)ϕx+ϕydydx=0

Comparing (A,B) shows that

ϕx=Mϕy=N

But since 2ϕxy=2ϕyx then for the above to be valid, we require that

My=Nx

If the above condition is satisfied, then the original ode is called exact. We still need to determine ϕ(x,y) but at least we know now that we can do that since the condition 2ϕxy=2ϕyx is satisfied. If this condition is not satisfied then this method will not work and we have to now look for an integrating factor to force this condition, which might or might not exist. The first step is to write the ODE in standard form to check for exactness, which is

(1A)M(x,y)dx+N(x,y)dy=0

Therefore

(yc)dy=(by2+ax)dx(2A)(by2ax)dx+(yc)dy=0

Comparing (1A) and (2A) shows that

M(x,y)=by2axN(x,y)=yc

The next step is to determine if the ODE is is exact or not. The ODE is exact when the following condition is satisfied

My=Nx

Using result found above gives

My=y(by2ax)=2by

And

Nx=x(yc)=0

Since MyNx, then the ODE is not exact. Since the ODE is not exact, we will try to find an integrating factor to make it exact. Let

A=1N(MyNx)=1yc((2by)(0))=2bc

Since A does not depend on y, then it can be used to find an integrating factor. The integrating factor μ is

μ=eAdx=e2bcdx

The result of integrating gives

μ=e2bxc=e2bxc

M and N are multiplied by this integrating factor, giving new M and new N which are called M and N for now so not to confuse them with the original M and N.

M=μM=e2bxc(by2ax)=(by2+ax)e2bxc

And

N=μN=e2bxc(yc)=yce2bxc

Now a modified ODE is ontained from the original ODE, which is exact and can be solved. The modified ODE is

M+Ndydx=0((by2+ax)e2bxc)+(yce2bxc)dydx=0

The following equations are now set up to solve for the function ϕ(x,y)

(1)ϕx=M(2)ϕy=N

Integrating (1) w.r.t. x gives

ϕxdx=Mdxϕxdx=(by2+ax)e2bxcdx(3)ϕ=c(2b2y2+2abx+ac)e2bxc4b2+f(y)

Where f(y) is used for the constant of integration since ϕ is a function of both x and y. Taking derivative of equation (3) w.r.t y gives

(4)ϕy=yce2bxc+f(y)

But equation (2) says that ϕy=yce2bxc. Therefore equation (4) becomes

(5)yce2bxc=yce2bxc+f(y)

Solving equation (5) for f(y) gives

f(y)=0

Therefore

f(y)=c2

Where c2 is constant of integration. Substituting this result for f(y) into equation (3) gives ϕ

ϕ=c(2b2y2+2abx+ac)e2bxc4b2+c2

But since ϕ itself is a constant function, then let ϕ=c3 where c2 is new constant and combining c2 and c3 constants into the constant c2 gives the solution as

c2=c(2b2y2+2abx+ac)e2bxc4b2

Solving for y gives

y=e2bxc2e2bxcc(2e2bxcabcx+e2bxcac24c2b2)2cby=e2bxc2e2bxcc(2e2bxcabcx+e2bxcac24c2b2)2cb

Which simplifies to

y=22c(2c2b2e2bxc+ac(bx+c2))e4bxce2bxc2cby=22c(2c2b2e2bxc+ac(bx+c2))e4bxce2bxc2cb

Summary of solutions found

y=22c(2c2b2e2bxc+ac(bx+c2))e4bxce2bxc2cby=22c(2c2b2e2bxc+ac(bx+c2))e4bxce2bxc2cb
Maple. Time used: 0.006 (sec). Leaf size: 69
ode:=c*diff(y(x),x) = (a*x+b*y(x)^2)/y(x); 
dsolve(ode,y(x), singsol=all);
 
y=4e2bxcc1b24axb2ac2by=4e2bxcc1b24axb2ac2b

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 solvec(ddxy(x))=ax+by(x)2y(x)Highest derivative means the order of the ODE is1ddxy(x)Solve for the highest derivativeddxy(x)=ax+by(x)2y(x)c
Mathematica. Time used: 6.918 (sec). Leaf size: 85
ode=c*D[y[x],x]==(a*x+b*y[x]^2)/y[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
y(x)iabx+ac2+b2c1(e2bxc)by(x)iabx+ac2+b2c1(e2bxc)b
Sympy. Time used: 1.733 (sec). Leaf size: 139
from sympy import * 
x = symbols("x") 
a = symbols("a") 
b = symbols("b") 
c = symbols("c") 
y = Function("y") 
ode = Eq(c*Derivative(y(x), x) - (a*x + b*y(x)**2)/y(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
[y(x)={22C1e2bxc2axbacb22forb>0b<0C1e2bxc+ax2e2bxccotherwise, y(x)={22C1e2bxc2axbacb22forb>0b<0C1e2bxc+ax2e2bxccotherwise]