### 13.4.3 Solving linear homogeneous second-order ODE with rational coefficients

The kovacicsols command finds Louivillian solutions of ordinary linear homogeneous second-order differential equations of the form

a y′′+b y′+c y=0, (1)

where a, b and c are rational functions of the independent variable. kovacicsols uses Kovacic’s algorithm.

- kovacicsols takes one mandatory argument and two optional arguments:
  - kode, an equality of the form of equation (1), an expression for the left-hand side, or a list of the coefficients [a,b,c].
  - Optionally, x the independent variable (by default x).
  - Optionally, y, the dependent variable (by default y). This option should not be used if the first argument is a list of coefficients.
- kovacicsols(kode ⟨,x,y ⟩) returns a Liouvillian solution of equation (1). This can be a list or an expression. An empty list means that there are no Liouvillian solutions to the equation. A non-empty list will contain one or two independent solutions to the differential equation. If the list contains two solutions y1 and y2, the general solution will be

  y=C1 y1+C2 y2

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

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

  If kovacicsols returns an expression, it will give the solution of the differential equation 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 differential equation.

#### Examples

Find the general solution to y′′=(1/x−3/16 x2) y.

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

| ⎡ ⎢ ⎣ | x |
1
4
| e |
2 | √ |
x
| ,x |
1
4
| e |
−2 | √ |
x
| ⎤ ⎥ ⎦

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

Solve x′(t)+3 (t2−t+1)/16 (t−1)2 t2 x(t)=0.

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

| ⎡ ⎢ ⎢ ⎢ ⎢ ⎣ | ⎛ ⎜ ⎝ | −t | ⎛ ⎝ | t−1 | ⎞ ⎠ | ⎛ ⎜ ⎝ | 2 | √ |
t2−t
| +2 t−1 | ⎞ ⎟ ⎠ | ⎞ ⎟ ⎠ |
1
4
| , | ⎛ ⎜ ⎝ | t | ⎛ ⎝ | t−1 | ⎞ ⎠ | ⎛ ⎜ ⎝ | 2 | √ |
t2−t
| −2 t+1 | ⎞ ⎟ ⎠ | ⎞ ⎟ ⎠ |
1
4
| ⎤ ⎥ ⎥ ⎥ ⎥ ⎦

so the general solution is, for C1,C2∈ℝ,

x(t)=C1 |
∜
t (t−1) (1−2 t−2 | √ |
t2−t
| )
| +
C2 |
∜
t (t−1) (1−2 t+2 | √ |
t2−t
| )
| .

Find a particular solution to y′′=4 x6−8 x5+12 x4+4 x3+7 x2−20 x+4/4 x4 y.

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

| ⎡ ⎢ ⎢ ⎢ ⎢ ⎣ |
⎛ ⎝ | −1+x2 | ⎞ ⎠ | e |
1
2
|  | ⎛ ⎝ | x3−2 x2−2 | ⎞ ⎠
x
x | √ |
x
| ⎤ ⎥ ⎥ ⎥ ⎥ ⎦

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

Solve y′′+y′=6 y/x2.

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

| ⎡ ⎢ ⎢ ⎣ |
⎛ ⎝ | 12+6 x+x2 | ⎞ ⎠ | e−x
x2
| ⎤ ⎥ ⎥ ⎦

Solve the Titchmarsh equation y′′+(19−x2) y=0.

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

| ⎡ ⎢ ⎢ ⎣ | ⎛ ⎜ ⎜ ⎝ |
945
16
| x− |
315
2
| x3+ |
189
2
| x5−18 x7+x9 | ⎞ ⎟ ⎟ ⎠ | e |
− |
x2
2
| ⎤ ⎥ ⎥ ⎦

This is only a single, particular solution.

Find the general solution of Halm’s equation (1+x2)2 y′′(x)+3 y(x)=0.

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

| ⎡ ⎢ ⎢ ⎢ ⎢ ⎣ |
−1+x2
√ |
x2+1
| ⎤ ⎥ ⎥ ⎥ ⎥ ⎦

The other basic solution is obtained by using (2).

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

−1+x2
√ |
x2+1
| ,− |
x | √ |
x2+1
x2+1

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

Find the general solution of the non-homogeneous equation y′′−27 y/36 (x−1)2=x+4. First you need to find the general solution to the corresponding homogeneous equation yh′′−27 yh/36 (x−1)2=0.

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

| ⎡ ⎢ ⎢ ⎢ ⎢ ⎣ |
−2 x+x2
√ |
x−1
| ⎤ ⎥ ⎥ ⎥ ⎥ ⎦

Call this solution y1 and find the other basic independent solution by using (2).

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

− |
√ |
x−1
2 x−2

So 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:

yp=−y1 | ∫ |
y2 f(x)
W
| d x+y2 | ∫ |
y1 f(x)
W
| d x,

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

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

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

4 x3+72 x2−156 x+80
21

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

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

true |  |  |  |  |  |  |  |  |  |

Solve the equation y′′=(3/16 x (x−1)−2/9 (x−1)2−3/16 x2)y from the original Kovacic’s paper.

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

−ω_4 x4 | ⎛ ⎝ | x−1 | ⎞ ⎠ | 4
+ |
ω_3 x3 | ⎛ ⎝ | x−1 | ⎞ ⎠ | 3 | ⎛ ⎝ | 7 x−3 | ⎞ ⎠
3
| − |
ω_2 x2 | ⎛ ⎝ | x−1 | ⎞ ⎠ | 2 | ⎛ ⎝ | 48 x2−41 x+9 | ⎞ ⎠
24
+ |
ω_ x | ⎛ ⎝ | x−1 | ⎞ ⎠ | ⎛ ⎝ | 320 x3−409 x2+180 x−27 | ⎞ ⎠
432
+ |
−2048 x4+3484 x3−2313 x2+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 you can try the Ferrari method to obtain ω0.

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

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

1
20736
| ω_4 | ⎛ ⎝ | 135 t4−616 t3−144 t2+3072 t−4096 | ⎞ ⎠ | − |
1
54
| ω_3 t | ⎛ ⎝ | t+1 | ⎞ ⎠ | ⎛ ⎝ | 23 t2−92 t+128 | ⎞ ⎠
− |
1
24
| ω_2 t2 | ⎛ ⎝ | t+1 | ⎞ ⎠ | ⎛ ⎝ | 15 t3−80 t2+80 t+256 | ⎞ ⎠ | + |
2
3
| ω_ t3 | ⎛ ⎝ | t−4 | ⎞ ⎠ | ⎛ ⎝ | t+1 | ⎞ ⎠ | 2 | ⎛ ⎝ | 5 t+8 | ⎞ ⎠ | −t4 | ⎛ ⎝ | t+1 | ⎞ ⎠ | 2 | ⎛ ⎝ | t+4 | ⎞ ⎠ | ⎛ ⎝ | 5 t+4 | ⎞ ⎠