2.1.20 Problem 4 (ii)

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

Internal problem ID [18436]
Book : Elementary Differential Equations. By R.L.E. Schwarzenberger. Chapman and Hall. London. First Edition (1969)
Section : Chapter 3. Solutions of first-order equations. Exercises at page 47
Problem number : 4 (ii)
Date solved : Monday, March 31, 2025 at 05:28:38 PM
CAS classification : [_separable]

Solved using first_order_ode_separable

Time used: 0.071 (sec)

Solve

x+xtan(t)=0

The ode

(1)x=xtan(t)

is separable as it can be written as

x=xtan(t)=f(t)g(x)

Where

f(t)=tan(t)g(x)=x

Integrating gives

1g(x)dx=f(t)dt1xdx=tan(t)dt
ln(x)=ln(cos(t))+c1

Taking the exponential of both sides the solution becomes

x=c1cos(t)

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

x=0

for x gives

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

x=0x=c1cos(t)
Figure 2.35: Slope field x+xtan(t)=0

Summary of solutions found

x=0x=c1cos(t)
Solved using first_order_ode_linear

Time used: 0.024 (sec)

Solve

x+xtan(t)=0

In canonical form a linear first order is

x+q(t)x=p(t)

Comparing the above to the given ode shows that

q(t)=tan(t)p(t)=0

The integrating factor μ is

μ=eqdt=etan(t)dt=sec(t)

The ode becomes

ddtμx=0ddt(xsec(t))=0

Integrating gives

xsec(t)=0dt+c2=c2

Dividing throughout by the integrating factor sec(t) gives the final solution

x=c2cos(t)
Figure 2.36: Slope field x+xtan(t)=0

Summary of solutions found

x=c2cos(t)
Solved using first_order_ode_homog_type_D2

Time used: 0.151 (sec)

Solve

x+xtan(t)=0

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

u(t)t+u(t)+u(t)ttan(t)=0

Which is now solved The ode

(2)u(t)=u(t)(tan(t)t+1)t

is separable as it can be written as

u(t)=u(t)(tan(t)t+1)t=f(t)g(u)

Where

f(t)=tan(t)t+1tg(u)=u

Integrating gives

1g(u)du=f(t)dt1udu=tan(t)t+1tdt
ln(u(t))=ln(cos(t)t)+c3

Taking the exponential of both sides the solution becomes

u(t)=c3cos(t)t

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(t) gives

u(t)=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(t)=0u(t)=c3cos(t)t

Converting u(t)=0 back to x gives

x=0

Converting u(t)=c3cos(t)t back to x gives

x=c3cos(t)
Figure 2.37: Slope field x+xtan(t)=0

Summary of solutions found

x=0x=c3cos(t)
Solved using first_order_ode_exact

Time used: 0.075 (sec)

Solve

x+xtan(t)=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(t,x)dt+N(t,x)dx=0

Therefore

dx=(xtan(t))dt(2A)(xtan(t))dt+dx=0

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

M(t,x)=xtan(t)N(t,x)=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

Mx=Nt

Using result found above gives

Mx=x(xtan(t))=tan(t)

And

Nt=t(1)=0

Since MxNt, 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(MxNt)=1((tan(t))(0))=tan(t)

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

μ=eAdt=etan(t)dt

The result of integrating gives

μ=eln(cos(t))=sec(t)

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=sec(t)(xtan(t))=xtan(t)sec(t)

And

N=μN=sec(t)(1)=sec(t)

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

M+Ndxdt=0(xtan(t)sec(t))+(sec(t))dxdt=0

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

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

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

ϕxdx=Ndxϕxdx=sec(t)dx(3)ϕ=xsec(t)+f(t)

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

(4)ϕt=xtan(t)sec(t)+f(t)

But equation (1) says that ϕt=xtan(t)sec(t). Therefore equation (4) becomes

(5)xtan(t)sec(t)=xtan(t)sec(t)+f(t)

Solving equation (5) for f(t) gives

f(t)=0

Therefore

f(t)=c4

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

ϕ=xsec(t)+c4

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

c4=xsec(t)

Solving for x gives

x=c4sec(t)

Which simplifies to

x=c4cos(t)
Figure 2.38: Slope field x+xtan(t)=0

Summary of solutions found

x=c4cos(t)
Solved using first_order_ode_LIE

Time used: 0.264 (sec)

Solve

x+xtan(t)=0

Writing the ode as

x=xtan(t)x=ω(t,x)

The condition of Lie symmetry is the linearized PDE given by

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

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

(1E)ξ=ta2+xa3+a1(2E)η=tb2+xb3+b1

Where the unknown coefficients are

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

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

(5E)b2xtan(t)(b3a2)x2tan(t)2a3+x(1+tan(t)2)(ta2+xa3+a1)+tan(t)(tb2+xb3+b1)=0

Putting the above in normal form gives

tan(t)2txa2+tan(t)2xa1+tan(t)tb2+xtan(t)a2+txa2+x2a3+tan(t)b1+xa1+b2=0

Setting the numerator to zero gives

(6E)tan(t)2txa2+tan(t)2xa1+tan(t)tb2+xtan(t)a2+txa2+x2a3+tan(t)b1+xa1+b2=0

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

{t,x,tan(t)}

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

{t=v1,x=v2,tan(t)=v3}

The above PDE (6E) now becomes

(7E)v32v1v2a2+v32v2a1+v1v2a2+v2v3a2+v22a3+v3v1b2+v2a1+v3b1+b2=0

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

{v1,v2,v3}

Equation (7E) now becomes

(8E)v32v1v2a2+v32v2a1+v1v2a2+v2v3a2+v22a3+v3v1b2+v2a1+v3b1+b2=0

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

a1=0a2=0a3=0b1=0b2=0

Solving the above equations for the unknowns gives

a1=0a2=0a3=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η=x

The next step is to determine the canonical coordinates R,S. The canonical coordinates map (t,x)(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)dtξ=dxη=dS

The above comes from the requirements that (ξt+ηx)S(t,x)=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=t

S is found from

S=1ηdy=1xdy

Which results in

S=ln(x)

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

(2)dSdR=St+ω(t,x)SxRt+ω(t,x)Rx

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

ω(t,x)=xtan(t)

Evaluating all the partial derivatives gives

Rt=1Rx=0St=0Sx=1x

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

(2A)dSdR=tan(t)

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

dSdR=tan(R)

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=tan(R)dRS(R)=ln(cos(R))+c7

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

ln(x)=ln(cos(t))+c7

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 t,x coordinates

Canonical coordinates transformation

ODE in canonical coordinates (R,S)

dxdt=xtan(t)

dSdR=tan(R)

R=tS=ln(x)

Solving for x gives

x=cos(t)ec7
Figure 2.39: Slope field x+xtan(t)=0

Summary of solutions found

x=cos(t)ec7
Maple. Time used: 0.001 (sec). Leaf size: 8
ode:=diff(x(t),t)+x(t)*tan(t) = 0; 
dsolve(ode,x(t), singsol=all);
 
x=c1cos(t)

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 solveddtx(t)+x(t)tan(t)=0Highest derivative means the order of the ODE is1ddtx(t)Solve for the highest derivativeddtx(t)=x(t)tan(t)Separate variablesddtx(t)x(t)=tan(t)Integrate both sides with respect totddtx(t)x(t)dt=tan(t)dt+C1Evaluate integralln(x(t))=ln(cos(t))+C1Solve forx(t)x(t)=eC1cos(t)Redefine the integration constant(s)x(t)=C1cos(t)
Mathematica. Time used: 0.032 (sec). Leaf size: 15
ode=D[x[t],t]+x[t]*Tan[t]==0; 
ic={}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
x(t)c1cos(t)x(t)0
Sympy. Time used: 0.196 (sec). Leaf size: 7
from sympy import * 
t = symbols("t") 
x = Function("x") 
ode = Eq(x(t)*tan(t) + Derivative(x(t), t),0) 
ics = {} 
dsolve(ode,func=x(t),ics=ics)
 
x(t)=C1cos(t)