### 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.