2.1.12 Problem 12

Existence and uniqueness analysis
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
Maple
Mathematica
Sympy

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

Existence and uniqueness analysis

Solve

y=2yx

With initial conditions

y(0)=0

This is a linear ODE. In canonical form it is written as

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

Where here

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

Hence the ode is

y2yx=0

The domain of q(x)=2x is

{x<00<x}

But the point x0=0 is not inside this domain. Hence existence and uniqueness theorem does not apply. There could be infinite number of solutions, or one solution or no solution at all.

Solved using first_order_ode_linear

Time used: 0.034 (sec)

Solve

y=2yx

With initial conditions

y(0)=0

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

Solving for the constant of integration from initial conditions, the solution becomes

y=0
Solution plot Slope field y=2yx

Summary of solutions found

y=0
Solved using first_order_ode_separable

Time used: 0.053 (sec)

Solve

y=2yx

With initial conditions

y(0)=0

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

Solving for the constant of integration from initial conditions, the solution becomes

y=0
Solution plot Slope field y=2yx

Summary of solutions found

y=0
Solved using first_order_ode_homog_A

Time used: 0.193 (sec)

Solve

y=2yx

With initial conditions

y(0)=0

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

Solving for the constant of integration from initial conditions, the solution becomes

y=0
Solution plot Slope field y=2yx

Summary of solutions found

y=0
Solved using first_order_ode_homog_type_D2

Time used: 0.047 (sec)

Solve

y=2yx

With initial conditions

y(0)=0

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

Solving for the constant of integration from initial conditions, the solution becomes

y=0
Solution plot Slope field y=2yx

Summary of solutions found

y=0
Solved using first_order_ode_homog_type_maple_C

Time used: 0.247 (sec)

Solve

y=2yx

With initial conditions

y(0)=0

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

Solving for the constant of integration from initial conditions, the solution becomes

y=0
Solution plot Slope field y=2yx

Summary of solutions found

y=0
Solved using first_order_ode_exact

Time used: 0.077 (sec)

Solve

y=2yx

With initial conditions

y(0)=0

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 the constant of integration from initial conditions, the solution becomes

yx2=0

Solving for y gives

y=0
Solution plot Slope field y=2yx

Summary of solutions found

y=0
Maple. Time used: 0.039 (sec). Leaf size: 9
ode:=diff(y(x),x) = 2*y(x)/x; 
ic:=y(0) = 0; 
dsolve([ode,ic],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 solve[ddxy(x)=2y(x)x,y(0)=0]Highest 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)=C1x2Use initial conditiony(0)=00=0Solve for_C1C1=C1Substitute_C1=_C1into general solution and simplifyy(x)=C1x2Solution to the IVPy(x)=C1x2
Mathematica. Time used: 0.002 (sec). Leaf size: 6
ode=D[y[x],x] == 2*y[x]/x; 
ic=y[0]==0; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
y(x)0
Sympy
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(Derivative(y(x), x) - 2*y(x)/x,0) 
ics = {y(0): 0} 
dsolve(ode,func=y(x),ics=ics)
 
ValueError : Couldnt solve for initial conditions