### 1 Introduction

Detailed description of Kovacic algorithm for solving second order linear ode with rational coeﬃcients is given with many solved examples showing how the algorithm works step by step.

The algorithm is ﬁrst described based on Kovacic original 1985 paper (1) and later described in separate section based on modiﬁed Saunders/Smith algorithm in papers (2,3). The same ode examples are solved using both algorithms to show the diﬀerence.

Given the ode \begin {align} y^{\prime \prime }\left ( x\right ) +ay^{\prime }\left ( x\right ) +by\left ( x\right ) & =0\tag {1}\\ a,b & \in \mathbb {C} \left ( x\right ) \nonumber \end {align}

It is transformed to the following ode by eliminating the ﬁrst derivative \begin {equation} z^{\prime \prime }=rz\qquad r\in \mathbb {C} \left ( x\right ) \tag {2} \end {equation} This is done using what is known as the Liouville transformation given by\begin {equation} z=ye^{\frac {1}{2}\int adx} \tag {3} \end {equation} Where $$r$$ in (2) is given by \begin {equation} r=\frac {1}{4}a^{2}+\frac {1}{2}a^{\prime }-b \tag {4} \end {equation} It is equation (2) (called the DE from now on) which is solved using the Kovacic algorithm and not Eq. (1). The solution to (1) can be obtained using (3) once $$y$$ is found. Kovacic algorithm ﬁnds a Liouvillian solution to (2) if one exists. There are 4 cases

1. DE has solution $$z=e^{\int \omega dx}$$ where $$\omega \in \mathbb {C} \left ( x\right )$$.
2. DE has solution $$z=e^{\int \omega dx}$$ where $$\omega$$ is polynomial over $$\mathbb {C} \left ( x\right )$$ of degree $$2$$ and case (1) does not hold.
3. Solutions of DE are algebraic over $$\mathbb {C} \left ( x\right )$$ and case 1,2 do not hold.
4. DE has no Liouvillian solution.

Before describing how the algorithm works, there are necessary (but not suﬃcient) conditions that should be checked to determine which case of the above the ode satisﬁes.

The following are the necessary conditions for each case.  To check each case, let $$r=\frac {s}{t}$$ where $$\gcd \left ( s,t\right ) =1$$. This means there is no common factor between $$s,t$$. The order of $$r$$ at $$\infty$$ is deﬁned as $$\deg \left ( t\right ) -\deg \left ( s\right )$$.

For an example, if $$r=\frac {1}{x^{2}}$$ then $$O\left ( \infty \right ) =2-0=2$$. And if $$r=\frac {1+x}{3x^{2}}$$ then $$O\left ( \infty \right ) =2-1=1$$. The poles of $$r$$ and the order of each pole needs to be determined.

The poles of $$r$$ are the zeros of $$t$$. For example if $$t=\left ( 1-x\right ) ^{2}\left ( x\right )$$ then there is one pole is at $$x=1$$ of order $$2$$ and one pole at $$x=0$$ of order $$1$$.

Knowing these two pieces of information is all what is needed to determine the necessary conditions for each case. The necessary conditions for each case are the following

1. Case 1. Every pole of $$r$$ must have even order or its order is $$1$$. And $$O\left ( \infty \right )$$ is even or greater than $$2$$. For an example, given $$r=\left ( x^{2}+3\right )$$, this has a pole of order zero (since no poles), therefore $$O\left ( \infty \right ) =0-2=-2$$ which is even. Hence it satisﬁes case 1. (pole order zero, is even, since zero is even number).
2. Case 2. $$r$$ has at least one pole of order $$2$$ or the order is odd and greater than $$2.$$ There are no conditions related to $$O\left ( \infty \right )$$ for this case.
3. $$r$$ has only poles of order $$1$$ or $$2$$. And $$O\left ( \infty \right )$$ must be at least $$2$$.

If the conditions are not satisﬁed then there is no need to try that speciﬁc case as there will be no solution. However if the conditions are satisﬁed, this does not necessarily mean a solution exists for that case. This is what necessary but not suﬃcient conditions means.

The following table summarizes the above conditions and the possible $$L$$ list (to be described later) for each case.

 Case Allowed pole order for $$r$$ Allowed value for $$\mathcal {O}(\infty )$$ 1 $$\left \{ 0,1,2,4,6,8,\cdots \right \}$$ $$\left \{ \cdots ,-6,-4,-2,0,2,3,4,5,6,\cdots \right \}$$ 2 Need to have at least one pole that is either order $$2$$ or odd order greater than $$2$$. Any other pole order is allowed as long as the above condition is satisﬁed. Hence the following set of pole orders are all allowed. $$\{1,2\}$$,$$\{1,3\}$$,$$\{2\}$$,$$\{3\}$$,$$\{3,4\}$$,$$\{1,2,5\}$$. no condition 3 $$\left \{ 1,2\right \}$$ $$\left \{ 2,3,4,5,6,7,\cdots \right \}$$

Some observations: In case one no odd order pole is allowed except for order 1. And for case 3, only poles of order 1,2 are allowed. If $$O\left ( \infty \right ) =0$$, which means $$s$$ and $$t$$ have same degree, then only possibility is case one or case two. Case 3 is not possible. For case one, if $$O\left ( \infty \right )$$ is negative, then it has to be even. For example if $$r=$$ $$\frac {x^{6}}{\left ( x-1\right ) ^{2}}$$ then now $$O\left ( \infty \right ) =2-6=-4$$. But if $$r=\frac {x^{5}}{\left ( x-1\right ) ^{2}}$$ then $$O\left ( \infty \right ) =2-5=-3$$ and hence this can not be case 1.

The following are examples to help understand these conditions. Notice that if a pole is of order 2 and $$O\left ( \infty \right )$$ is say 2, then all three cases are met.

#### 1.1 Examples how to determine which case the ode belongs into

1.1.1 Example 1
1.1.2 Example 2
1.1.3 Example 3
1.1.4 Example 4
1.1.5 Example 5
1.1.6 Example 6
1.1.7 Example 7
1.1.8 Example 8

##### 1.1.1 Example 1

$r=\frac {4x^{6}-8x^{5}+12x^{4}+4x^{3}+7x^{2}-20x+4}{4x^{4}}$ There is one pole at $$x=0\,\$$of order $$4$$. And $$O\left ( \infty \right ) =4-6=-2$$. Conditions for case 1 are met. Since it has a pole of even order. Also $$O\left ( \infty \right )$$ is even. Case 2 are not satisﬁed, since there is no pole of order $$2$$ and no odd pole of order greater than $$2$$ exist. Case 3 is also not met, since the pole is order $$4$$ and case 3 will only work if pole is order 1 or 2. Hence $$L=\left [ 1\right ]$$

##### 1.1.2 Example 2

$r=x$ There is one pole of order zero (an even pole). So case 1 or 3 qualify. But $$O\left ( \infty \right ) =0-1=-1$$ which is odd. But case 1 and 3 require $$O\left ( \infty \right )$$ be even. Hence case 1,2,3 all fail. This is case 4 where there is no Liouvillian solution. This is known already, because this is the known Airy ode $$y^{\prime \prime }=xy$$. Its solution are the Airy special functions. These are not Liouvillian solutions. Hence $$L=\left [ {}\right ]$$

##### 1.1.3 Example 3

\begin {align*} r & =\frac {1}{x}-\frac {3}{16x^{2}}\\ & =\frac {16x-3}{16x^{2}} \end {align*}

There is pole at $$x=0$$ of order $$2$$. And $$O\left ( \infty \right ) =2-1=1$$. Case 1 is not satisﬁed, since $$O\left ( \infty \right )$$ is not greater than 2. Also case 3 can not hold, since case 3 requires $$O\left ( \infty \right )$$ be at least order 2 and here it is 1. Only possibility left is case 2. There is one pole of order 2. Since case 2 have no conditions on $$O\left ( \infty \right )$$ to satisfy, then case 2 has been met. So this is case 2 only. $$L=\left [ 2\right ]$$

##### 1.1.4 Example 4

\begin {align*} r & =-\frac {3}{16x^{2}}-\frac {2}{9\left ( x-1\right ) ^{2}}+\frac {3}{16x\left ( x-1\right ) }\\ & =-\frac {-32x^{2}+27x-27}{144x^{2}\left ( x-1\right ) ^{2}} \end {align*}

There is pole at $$x=0$$ of order 2, and pole at $$x=1$$ of order 2. And $$O\left ( \infty \right ) =4-2=2.$$we see that $$O\left ( \infty \right )$$ is satisﬁed for case 1 and case 3. Recall that case 2 has no $$O\left ( \infty \right )$$ conditions. The pole order is satisﬁed for case 1 (must have even order or order 1), also the pole order is satisﬁed for case 2 (have at least one pole of order 2), and pole order is satisﬁed for case 3 (can only have poles of order 1 or 2). So all three cases are satisﬁed. Remember that just because the necessary conditions are met, this does not mean a Liouvillian solution exists. Hence $$L=\left [ 1,2,4,6,12\right ]$$.

##### 1.1.5 Example 5

$r=\frac {-5x+27}{36\left ( x-1\right ) ^{2}}$ $$O\left ( \infty \right ) =2-1=1$$. And $$r$$ has pole at $$x=1$$ of order 2. We see that $$O\left ( \infty \right )$$ is not satisﬁed for case 1 and case 3 (case 1 requires even or greater than 2 for $$O\left ( \infty \right )$$ and case 3 requires $$O\left ( \infty \right ) =2$$.). So our only hope is case 2. Case 2 has no $$O\left ( \infty \right )$$ conditions. But it needs to have at least one pole of order 2 or a pole which is odd order and greater than 2. This is satisﬁed here, since pole is order 2. Hence only case 2 is possible. Hence $$L=[2]$$. I do not understand why paper says all three cases are possible for this. This seems to be an error in the paper (1).

##### 1.1.6 Example 6

$r=\left ( x^{2}+3\right )$ There is zero order pole. (even order). $$O\left ( \infty \right ) =0-2=-2$$. Hence only case 1 is possible. $$L=\left [ 1\right ]$$

##### 1.1.7 Example 7

$r=\frac {1}{x^{2}}$ One pole at $$x=0$$ of order 2. And $$O\left ( \infty \right ) =2-0=2$$. Case 1 is satisﬁed. Also case 2 since pole is even order. Also case 3 is satisﬁed. Hence all three cases are satisﬁed. $$L=[1,2,4,6,12]$$

##### 1.1.8 Example 8

$r=\frac {4x^{2}-15}{4x^{2}}$ We see that $$O\left ( \infty \right ) =0$$. From the table this means only case 1 and 2 are possible. (since case 2 has no conditions on $$O\left ( \infty \right )$$ and only case 1 allows zero order for $$O\left ( \infty \right )$$). We see there is a pole at $$x=0$$ of order 2. This is allowed by both case 1 and case 2. Hence case 1,2 are possible and $$L=\left [ 1,2\right ]$$