2.1.13 Problem 13

Solved using first_order_ode_linear
Solved using first_order_ode_separable
Solved using first_order_ode_homog_A
Solved using first_order_ode_homog_type_D2
Solved using first_order_ode_homog_type_maple_C
Solved using first_order_ode_exact
Solved using first_order_ode_LIE
Maple
Mathematica
Sympy

Internal problem ID [8724]
Book : Own collection of miscellaneous problems
Section : section 1.0
Problem number : 13
Date solved : Friday, April 25, 2025 at 04:58:04 PM
CAS classification : [_separable]

Solved using first_order_ode_linear

Time used: 0.033 (sec)

Solve

y=2yx

In canonical form a linear first order is

y+q(x)y=p(x)

Comparing the above to the given ode shows that

q(x)=2xp(x)=0

The integrating factor μ is

μ=eqdx=e2xdx=1x2

The ode becomes

ddxμy=0ddx(yx2)=0

Integrating gives

yx2=0dx+c1=c1

Dividing throughout by the integrating factor 1x2 gives the final solution

y=c1x2
Figure 2.27: Slope field y=2yx

Summary of solutions found

y=c1x2
Solved using first_order_ode_separable

Time used: 0.080 (sec)

Solve

y=2yx

The ode

(1)y=2yx

is separable as it can be written as

y=2yx=f(x)g(y)

Where

f(x)=2xg(y)=y

Integrating gives

1g(y)dy=f(x)dx1ydy=2xdx
ln(y)=ln(x2)+c2

Taking the exponential of both sides the solution becomes

y=c2x2

We now need to find the singular solutions, these are found by finding for what values g(y) is zero, since we had to divide by this above. Solving g(y)=0 or

y=0

for y gives

y=0

Now we go over each such singular solution and check if it verifies the ode itself and any initial conditions given. If it does not then the singular solution will not be used.

Therefore the solutions found are

y=0y=c2x2
Figure 2.28: Slope field y=2yx

Summary of solutions found

y=0y=c2x2
Solved using first_order_ode_homog_A

Time used: 0.180 (sec)

Solve

y=2yx

In canonical form, the ODE is

y=F(x,y)(1)=2yx

An ode of the form y=M(x,y)N(x,y) is called homogeneous if the functions M(x,y) and N(x,y) are both homogeneous functions and of the same order. Recall that a function f(x,y) is homogeneous of order n if

f(tnx,tny)=tnf(x,y)

In this case, it can be seen that both M=2y and N=x are both homogeneous and of the same order n=1. Therefore this is a homogeneous ode. Since this ode is homogeneous, it is converted to separable ODE using the substitution u=yx, or y=ux. Hence

dydx=dudxx+u

Applying the transformation y=ux to the above ODE in (1) gives

dudxx+u=2ududx=u(x)x

Or

u(x)u(x)x=0

Or

u(x)xu(x)=0

Which is now solved as separable in u(x).

The ode

(2)u(x)=u(x)x

is separable as it can be written as

u(x)=u(x)x=f(x)g(u)

Where

f(x)=1xg(u)=u

Integrating gives

1g(u)du=f(x)dx1udu=1xdx
ln(u(x))=ln(x)+c3

Taking the exponential of both sides the solution becomes

u(x)=c3x

We now need to find the singular solutions, these are found by finding for what values g(u) is zero, since we had to divide by this above. Solving g(u)=0 or

u=0

for u(x) gives

u(x)=0

Now we go over each such singular solution and check if it verifies the ode itself and any initial conditions given. If it does not then the singular solution will not be used.

Therefore the solutions found are

u(x)=0u(x)=c3x

Converting u(x)=0 back to y gives

y=0

Converting u(x)=c3x back to y gives

y=c3x2
Figure 2.29: Slope field y=2yx

Summary of solutions found

y=0y=c3x2
Solved using first_order_ode_homog_type_D2

Time used: 0.049 (sec)

Solve

y=2yx

Applying change of variables y=u(x)x, then the ode becomes

u(x)x+u(x)=2u(x)

Which is now solved The ode

(3)u(x)=u(x)x

is separable as it can be written as

u(x)=u(x)x=f(x)g(u)

Where

f(x)=1xg(u)=u

Integrating gives

1g(u)du=f(x)dx1udu=1xdx
ln(u(x))=ln(x)+c4

Taking the exponential of both sides the solution becomes

u(x)=c4x

We now need to find the singular solutions, these are found by finding for what values g(u) is zero, since we had to divide by this above. Solving g(u)=0 or

u=0

for u(x) gives

u(x)=0

Now we go over each such singular solution and check if it verifies the ode itself and any initial conditions given. If it does not then the singular solution will not be used.

Therefore the solutions found are

u(x)=0u(x)=c4x

Converting u(x)=0 back to y gives

y=0

Converting u(x)=c4x back to y gives

y=c4x2
Figure 2.30: Slope field y=2yx

Summary of solutions found

y=0y=c4x2
Solved using first_order_ode_homog_type_maple_C

Time used: 0.228 (sec)

Solve

y=2yx

Let Y=yy0 and X=xx0 then the above is transformed to new ode in Y(X)

ddXY(X)=2Y(X)+2y0X+x0

Solving for possible values of x0 and y0 which makes the above ode a homogeneous ode results in

x0=0y0=0

Using these values now it is possible to easily solve for Y(X). The above ode now becomes

ddXY(X)=2Y(X)X

In canonical form, the ODE is

Y=F(X,Y)(1)=2YX

An ode of the form Y=M(X,Y)N(X,Y) is called homogeneous if the functions M(X,Y) and N(X,Y) are both homogeneous functions and of the same order. Recall that a function f(X,Y) is homogeneous of order n if

f(tnX,tnY)=tnf(X,Y)

In this case, it can be seen that both M=2Y and N=X are both homogeneous and of the same order n=1. Therefore this is a homogeneous ode. Since this ode is homogeneous, it is converted to separable ODE using the substitution u=YX, or Y=uX. Hence

dYdX=dudXX+u

Applying the transformation Y=uX to the above ODE in (1) gives

dudXX+u=2ududX=u(X)X

Or

ddXu(X)u(X)X=0

Or

(ddXu(X))Xu(X)=0

Which is now solved as separable in u(X).

The ode

(4)ddXu(X)=u(X)X

is separable as it can be written as

ddXu(X)=u(X)X=f(X)g(u)

Where

f(X)=1Xg(u)=u

Integrating gives

1g(u)du=f(X)dX1udu=1XdX
ln(u(X))=ln(X)+c5

Taking the exponential of both sides the solution becomes

u(X)=c5X

We now need to find the singular solutions, these are found by finding for what values g(u) is zero, since we had to divide by this above. Solving g(u)=0 or

u=0

for u(X) gives

u(X)=0

Now we go over each such singular solution and check if it verifies the ode itself and any initial conditions given. If it does not then the singular solution will not be used.

Therefore the solutions found are

u(X)=0u(X)=c5X

Converting u(X)=0 back to Y(X) gives

Y(X)=0

Converting u(X)=c5X back to Y(X) gives

Y(X)=X2c5

Using the solution for Y(X)

(A)Y(X)=0

And replacing back terms in the above solution using

Y=y+y0X=x0+x

Or

Y=yX=x

Then the solution in y becomes using EQ (A)

y=0

Using the solution for Y(X)

(A)Y(X)=X2c5

And replacing back terms in the above solution using

Y=y+y0X=x0+x

Or

Y=yX=x

Then the solution in y becomes using EQ (A)

y=x2c5
Figure 2.31: Slope field y=2yx

Summary of solutions found

y=0y=x2c5
Solved using first_order_ode_exact

Time used: 0.083 (sec)

Solve

y=2yx

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

dy=(2yx)dx(2A)(2yx)dx+dy=0

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

M(x,y)=2yxN(x,y)=1

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

And

Nx=x(1)=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)=1((2x)(0))=2x

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

μ=eAdx=e2xdx

The result of integrating gives

μ=e2ln(x)=1x2

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=1x2(2yx)=2yx3

And

N=μN=1x2(1)=1x2

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

M+Ndydx=0(2yx3)+(1x2)dydx=0

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

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

Integrating (2) w.r.t. y gives

ϕydy=Ndyϕydy=1x2dy(3)ϕ=yx2+f(x)

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

(4)ϕx=2yx3+f(x)

But equation (1) says that ϕx=2yx3. Therefore equation (4) becomes

(5)2yx3=2yx3+f(x)

Solving equation (5) for f(x) gives

f(x)=0

Therefore

f(x)=c6

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

ϕ=yx2+c6

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

c6=yx2

Solving for y gives

y=c6x2
Figure 2.32: Slope field y=2yx

Summary of solutions found

y=c6x2
Solved using first_order_ode_LIE

Time used: 0.299 (sec)

Solve

y=2yx

Writing the ode as

y=2yxy=ω(x,y)

The condition of Lie symmetry is the linearized PDE given by

(A)ηx+ω(ηyξx)ω2ξyωxξωyη=0

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

(1E)ξ=xa2+ya3+a1(2E)η=xb2+yb3+b1

Where the unknown coefficients are

{a1,a2,a3,b1,b2,b3}

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

(5E)b2+2y(b3a2)x4y2a3x2+2y(xa2+ya3+a1)x22(xb2+yb3+b1)x=0

Putting the above in normal form gives

b2x2+2y2a3+2xb12ya1x2=0

Setting the numerator to zero gives

(6E)b2x22y2a32xb1+2ya1=0

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

{x,y}

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

{x=v1,y=v2}

The above PDE (6E) now becomes

(7E)2a3v22b2v12+2a1v22b1v1=0

Collecting the above on the terms vi introduced, and these are

{v1,v2}

Equation (7E) now becomes

(8E)2a3v22b2v12+2a1v22b1v1=0

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

2a1=02a3=02b1=0b2=0

Solving the above equations for the unknowns gives

a1=0a2=a2a3=0b1=0b2=0b3=b3

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

ξ=0η=y

The next step is to determine the canonical coordinates R,S. The canonical coordinates map (x,y)(R,S) where (R,S) 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

(1)dxξ=dyη=dS

The above comes from the requirements that (ξx+ηy)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 ξ=0 then in this special case

R=x

S is found from

S=1ηdy=1ydy

Which results in

S=ln(y)

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

(2)dSdR=Sx+ω(x,y)SyRx+ω(x,y)Ry

Where in the above Rx,Ry,Sx,Sy are all partial derivatives and ω(x,y) is the right hand side of the original ode given by

ω(x,y)=2yx

Evaluating all the partial derivatives gives

Rx=1Ry=0Sx=0Sy=1y

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

(2A)dSdR=2x

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

dSdR=2R

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 ddRS(R)=f(R), then we only need to integrate f(R).

dS=2RdRS(R)=2ln(R)+c9

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

ln(y)=2ln(x)+c9

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)

dydx=2yx

dSdR=2R

R=xS=ln(y)

Solving for y gives

y=ec9x2
Figure 2.33: Slope field y=2yx

Summary of solutions found

y=ec9x2
Maple. Time used: 0.002 (sec). Leaf size: 9
ode:=diff(y(x),x) = 2*y(x)/x; 
dsolve(ode,y(x), singsol=all);
 
y=c1x2

Maple trace

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

Maple step by step

Let’s solveddxy(x)=2y(x)xHighest derivative means the order of the ODE is1ddxy(x)Solve for the highest derivativeddxy(x)=2y(x)xSeparate variablesddxy(x)y(x)=2xIntegrate both sides with respect toxddxy(x)y(x)dx=2xdx+C1Evaluate integralln(y(x))=2ln(x)+C1Solve fory(x)y(x)=eC1x2Redefine the integration constant(s)y(x)=C1x2
Mathematica. Time used: 0.024 (sec). Leaf size: 16
ode=D[y[x],x] == 2*y[x]/x; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
y(x)c1x2y(x)0
Sympy. Time used: 0.101 (sec). Leaf size: 7
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(Derivative(y(x), x) - 2*y(x)/x,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
y(x)=C1x2