### 5.57.3 Solving linear homogeneous second-order ODE with rational coefficients : kovacicsols

kovacicsols uses Kovacic’s algorithm to find a Liouvillian solution of an ordinary linear homogeneous second-order differential equation

a y″+b y′+c y=0, (6)

where a, b and c are rational functions of the independent variable. The command takes from one to three arguments :

- equation (6) as an expression (left-hand side), equality or a list of coefficients [a,b,c],
- independent variable (optional, by default x),
- dependent variable (optional, by default y).

The dependent variable should not be specified if the equation (6) is entered as a list of coefficients.

The return value can be a list or an expression. An empty list means that there are no Liouvillian solutions to the input equation. If a non-empty list is returned, it contains one or two independent solution(s) y1 (and y2) to the equation (6). The general solution to (6) is then

y=C1 y1+C2 y2,

where C1,C2∈ℝ are arbitrary constants. However, for some equations only y1 is returned, in which case y2 can be obtained as (using reduction of order) :

y2=y1 | ∫ | y1−2. (7)

If kovacicsols returns an expression, it means that the solution to (6) is given implicitly. In that case the return value is a polynomial P of order n∈{4,6,12} in the variable omega_ (denoted here by ω) with rational coefficients rk, k=0,1,2,…,n. If P(ω0)=0 for some ω0, then y=exp(∫ω0) is a solution to the equation (6).

##### Examples.

In the first example we find the general solution to the equation

y″=

⎛
⎜
⎜
⎝

1
x

−

3
16 x2

⎞
⎟
⎟
⎠

y.

Input :

kovacicsols(y`''`=y*(1/x-3/16x`^`2))

Output :

[x`^`(1/4)*exp(2*sqrt(x)),x`^`(1/4)*exp(-2*sqrt(x))]

Therefore, y=C1 x1/4 e2 √x+C2 x1/4 e−2 √x is the general solution.

In the following example we solve the equation

x″(t)+

3 (t2−t+1)
16 (t−1)2 t2

x(t)=0.

Input :

kovacicsols(x`''`+3*(t`^`2-t+1)/(16*(t-1)`^`2*t`^`2)*x,t,x)

Output :

[(-t*(t-1)*(2*t+2*sqrt(t`^`2-t)-1))`^`(1/4), (t*(t-1)*(-2*t+2*sqrt(t`^`2-t)+1))`^`(1/4)]

Now for arbitrary C1,C2∈ℝ we have

x(t)=C1

∜

t (t−1) (1−2 t−2

√

t2−t

)

+

C2

∜

t (t−1) (1−2 t+2

√

t2−t

)

.

In the next example we find a particular solution to the equation

y″=

4 x6−8 x5+12 x4+4 x3+7 x2−20 x+4
4 x4

y.

Input :

r:=(4x`^`6-8x`^`5+12x`^`4+4x`^`3+7x`^`2-20x+4)/(4x`^`4):; kovacicsols(y`''`=r*y)

Output :

[(x`^`2-1)/(x*sqrt(x))*exp((x`^`3-2*x`^`2-2)/(2*x))]

Hence y=(x2−1) x−3/2 ex3−2 x2−2/2 x is a solution to the given equation.

A similar output is obtained when solving the equation

y″+y′=

6 y
x2

.

Input :

kovacicsols(y`''`+y`'`=6y/x`^`2)

Output :

[(x`^`2+6*x+12)*exp(-x)/x`^`2]

To solve Titchmarsh equation

y″+(19−x2) y=0,

input :

kovacicsols(y`''`+(19-x`^`2)*y=0,x,y)

We obtain a particular solution

y=

⎛
⎜
⎜
⎝

x9−18 x7+

189 x5
2

−

315 x3
2

+

945 x
16

⎞
⎟
⎟
⎠

exp

⎛
⎜
⎜
⎝

−

x2
2

⎞
⎟
⎟
⎠

.

To find the general solution of Halm’s equation

(1+x2)2 y″(x)+3 y(x)=0,

input :

sol:=kovacicsols((1+x`^`2)`^`2*y`''`+3y=0,x,y)

Output :

[(x`^`2-1)/(sqrt(x`^`2+1))]

The other basic solution is obtained by using (7). Input :

y1:=sol[0]; y2:=normal(y1*int(y1`^`-2,x))

Output :

(x`^`2-1)/(sqrt(x`^`2+1)),-x/(sqrt(x`^`2+1))

Therefore, y=C1 x2−1/√x2+1+C2 x/√x2+1, where C1,C2∈ℝ.

In the following example we find the general solution of the non-homogeneous equation

y″−

27 y
36 (x−1)2

=x+4.

First we need to find the general solution to the corresponding homogeneous equation yh″−27 yh/36 (x−1)2=0. Input :

sols:=kovacicsols(y`''`-y*27/(36*(x-1)`^`2),x,y)

Output :

[(x`^`2-2*x)/(sqrt(x-1))]

We call the obtained solution y1 and find the other basic independent solution by using (7). Input :

y1:=sols[0]:; y2:=y1*int(1/y1`^`2,x)

Output :

-1/(sqrt(x-1)*2)

Now the general solution of the homogeneous equation is

yh=C1 y1+C2 y2=

C1 (x2−2 x)+C2

√

x−1

, C1,C2∈ℝ.

A particular solution yp of the non-homogeneous equation can be obtained by variation of parameters as

yp=−y1

∫

y2 f(x)
W

dx+y2

∫

y1 f(x)
W

dx,

where f(x)=x+4 and W is the Wronskian of y1 and y2, i.e.

W=y1 y2′−y2 y1′≠ 0.

Input :

W:=y1*y2’-y2*y1’:; f:=x+4:; yp:=normal(-y1*int(y2*f/W,x)+y2*int(y1*f/W,x))

Output :

(4*x`^`3+72*x`^`2-156*x+80)/21

Hence yp=1/21 (4 x3+72 x2−156 x+80). Now y=yp+yh. We proceed by checking that it is indeed the general solution of the given equation. Input :

purge(C1,C2):; ysol:=yp+C1*y1+C2*y2:; normal(diff(ysol,x,2)-27/(36*(x-1)`^`2)*ysol)==f

Output :

true

In the next example we attempt to solve the equation from the original Kovacic’s paper :

y″=

⎛
⎜
⎜
⎝

3
16 x (x−1)

−

2
9 (x−1)2

−

3
16 x2

⎞
⎟
⎟
⎠

y.

Input :

r:=-3/(16x`^`2)-2/(9*(x-1)`^`2)+3/(16x*(x-1)):; kovacicsols(y`''`=r*y)

Output :

-omega_`^`4*x`^`4*(x-1)`^`4+ omega_`^`3*x`^`3*(x-1)`^`3*(7*x-3)/3- omega_`^`2*x`^`2*(x-1)`^`2*(48*x`^`2-41*x+9)/24+ omega_*x*(x-1)*(320*x`^`3-409*x`^`2+180*x-27)/432+ (-2048*x`^`4+3484*x`^`3-2313*x`^`2+702*x-81)/20736

The solution is y=exp(∫ω0), where ω0 is a zero of the above expression, thus being a root of a fourth-order polynomial in ω. In similar cases one can try the Ferrari method to obtain ω0.

We get similar output while trying to solve the equation

48 t (t+1) (5 t−4) y″+8 (25 t+16) (t−2) y′−(5 t+68) y=0.

Input :

de:=[48t*(t+1)*(5t-4),8*(25t+16)*(t-2),-(5t+68)]:; kovacicsols(de,t)

Output :

omega_`^`4*(135*t`^`4-616*t`^`3-144*t`^`2+3072*t-4096)/20736- omega_`^`2*t`^`2*(t+1)*(15*t`^`3-80*t`^`2+80*t+256)/24- t`^`4*(t+1)`^`2*(t+4)*(5*t+4)+ 2*omega_*t`^`3*(t+1)`^`2*(t-4)*(5*t+8)/3- omega_`^`3*t*(t+1)*(23*t`^`2-92*t+128)/54