2.1.9 Problem 2 (iii)

Existence and uniqueness analysis
Solved using first_order_ode_autonomous
Solved using first_order_ode_exact
Maple
Mathematica
Sympy

Internal problem ID [18425]
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 : 2 (iii)
Date solved : Monday, March 31, 2025 at 05:28:01 PM
CAS classification : [_quadrature]

Existence and uniqueness analysis

Solve

x=(x1)2

With initial conditions

x(0)=1

This is non linear first order ODE. In canonical form it is written as

x=f(t,x)=(x1)2

The x domain of f(t,x) when t=0 is

{<x<}

And the point x0=1 is inside this domain. Now we will look at the continuity of

fx=x((x1)2)=2x2

The x domain of fx when t=0 is

{<x<}

And the point x0=1 is inside this domain. Therefore solution exists and is unique.

Solved using first_order_ode_autonomous

Time used: 0.075 (sec)

Solve

x=(x1)2

With initial conditions

x(0)=1

Since the ode has the form x=f(x) and initial conditions (t0,x0) are given such that they satisfy the ode itself, then we can write

0=f(x)|x=x00=0

And the solution is immediately written as

x=x0x=1

Singular solutions are found by solving

(x1)2=0

for x. This is because we had to divide by this in the above step. This gives the following singular solution(s), which also have to satisfy the given ODE.

x=1

The following diagram is the phase line diagram. It classifies each of the above equilibrium points as stable or not stable or semi-stable.

Solution plot Slope field x=(x1)2

Summary of solutions found

x=1
Solved using first_order_ode_exact

Time used: 0.085 (sec)

Solve

x=(x1)2

With initial conditions

x(0)=1

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=((x1)2)dt(2A)((x1)2)dt+dx=0

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

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

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

Since A depends on x, it can not be used to obtain an integrating factor. We will now try a second method to find an integrating factor. Let

B=1M(NtMx)=1(x1)2((0)(2x+2))=2x1

Since B does not depend on t, it can be used to obtain an integrating factor. Let the integrating factor be μ. Then

μ=eBdx=e2x1dx

The result of integrating gives

μ=e2ln(x1)=1(x1)2

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

M=μM=1(x1)2((x1)2)=1

And

N=μN=1(x1)2(1)=1(x1)2

So now a modified ODE is obtained from the original ODE which will be exact and can be solved using the standard method. The modified ODE is

M+Ndxdt=0(1)+(1(x1)2)dxdt=0

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

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

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

ϕtdt=Mdtϕtdt=1dt(3)ϕ=t+f(x)

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

(4)ϕx=0+f(x)

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

(5)1(x1)2=0+f(x)

Solving equation (5) for f(x) gives

f(x)=1(x1)2

Integrating the above w.r.t x gives

f(x)dx=(1(x1)2)dxf(x)=1x1+c2

Where c2 is constant of integration. Substituting result found above for f(x) into equation (3) gives ϕ

ϕ=t1x1+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=t1x1

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

x=1
Solution plot Slope field x=(x1)2

Summary of solutions found

x=1
Maple. Time used: 0.012 (sec). Leaf size: 5
ode:=diff(x(t),t) = (x(t)-1)^2; 
ic:=x(0) = 1; 
dsolve([ode,ic],x(t), singsol=all);
 
x=1

Maple trace

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

Maple step by step

Let’s solve[ddtx(t)=(x(t)1)2,x(0)=1]Highest derivative means the order of the ODE is1ddtx(t)Solve for the highest derivativeddtx(t)=(x(t)1)2Separate variablesddtx(t)(x(t)1)2=1Integrate both sides with respect totddtx(t)(x(t)1)2dt=1dt+C1Evaluate integral1x(t)1=t+C1Solve forx(t)x(t)=C1+t1t+C1Use initial conditionx(0)=11=C11C1Solve for_C1No solutionSolution does not satisfy initial condition
Mathematica. Time used: 0.001 (sec). Leaf size: 6
ode=D[x[t],t]==(x[t]-1)^2; 
ic={x[0]==1}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
x(t)1
Sympy
from sympy import * 
t = symbols("t") 
x = Function("x") 
ode = Eq(-(x(t) - 1)**2 + Derivative(x(t), t),0) 
ics = {x(0): 1} 
dsolve(ode,func=x(t),ics=ics)
 
ValueError : Couldnt solve for initial conditions