## Return to Answer

2 fix typo

(this is a variation on Darij's answer)

Note that "holomic" holonomic" generating functions $f(x)$, i.e. generating functions satisfying a linear differential equation with polynomial coefficients (in $x$) enjoy rich closure properties.
For a (very brief) summary, see Table 1 of a paper on guessing (sorry, I couldn't find a better reference, but there should be one...). Moreover, all these closure properties can be made "effective": if we know the order and the degree of the coefficients of the diffential equation for $f(x)$ and for $g(x)$, we can (easily) compute bounds for order and coefficient degree of the differential equation for $f+g$, $f\cdot g$, etc.

Moreover, it turns out that the (Taylor) coefficient sequence of a holonomic generating function satisfies a linear recurrence with polynomial coefficients, i.e., is P-recursive, and the P-recursive sequences are precisely the coefficient sequences of holonomic generating functions.

Thus, to find such a recurrence (or differential equation), it is often easiest to use gfun for Maple by Bruno Salvy and Paul Zimmermann, or the Mathematica equivalent by Mallinger (I think). Unfortunately, the FriCAS package described in 1 only does the guessing part, i.e., you would need to compute the bounds yourself and then check. In the case at hand the results are below.

However, you also asked, whether the solution is hypergeometric. To check this, you simply feed the recurrence you found below into Petkovsek's program Hyper, it will tell you whether there is a hypergeometric solution. (most probably no, because if the degree of the coefficient polynomials of the hypergeometric solution are not huge, guessPRec and guessHolo would have found it.)

In case you are dealing with orthogonal polynomials, the Askey Wilson scheme by Koekoek and Swarttouw is a great reference to find the basic information.

```(1) -> guessHolo(cons(x, [(legendreP(n, x)-(1-1/n)*legendreP(n-2, x)) for n in 2..30]), variableName==t)

   (1)
   [
     [
         n
       [t ]f(t):
                 4     2  2     5     3           4     2  ,,
           ((- 2t  - 2t )x  + (t  + 6t  + t)x - 2t  - 2t )f  (t)

         + 
                 3       2      4      2           3       ,
           ((- 3t  - 7t)x  + (3t  + 15t  + 2)x - 8t  - 2t)f (t)

         + 
              2      2     3            2
           ((t  - 3)x  + (t  + 3t)x - 4t  + 2)f(t)
           =
           0
       ,
                    2           2 3      2       3 4      3 2     3
                3t x  - 2t   15t x  - 13t x   35t x  - 39t x  + 6t       4
      f(t)= x + ---------- + -------------- + --------------------- + O(t )]
                     2              6                   8
     ]
                                              Type: List(Expression(Integer))
(2) -> guessPRec cons(x, [(legendreP(n, x)-(1-1/n)*legendreP(n-2, x)) for n in 2..30])

   (2)
   [
     [
       f(n):
                 4      3      2             2     4      3      2
             ((4n  + 28n  + 67n  + 63n + 18)x  - 4n  - 28n  - 68n  - 68n - 24)
          *
             f(n + 2)
         + 
                    4      3       2              3
               (- 8n  - 52n  - 118n  - 107n - 30)x
             + 
                  4      3       2
               (8n  + 52n  + 120n  + 114n + 36)x
          *
             f(n + 1)
         + 
             4      3      2             2     4      3      2
         ((4n  + 24n  + 51n  + 46n + 15)x  - 4n  - 24n  - 52n  - 48n - 16)f(n)
           =
           0
       ,
                       2
                     3x  - 2
      f(0)= x, f(1)= -------]
                        2
     ]
                                              Type: List(Expression(Integer))
```
1

(this is a variation on Darij's answer)

Note that "holomic" generating functions $f(x)$, i.e. generating functions satisfying a linear differential equation with polynomial coefficients (in $x$) enjoy rich closure properties.
For a (very brief) summary, see Table 1 of a paper on guessing (sorry, I couldn't find a better reference, but there should be one...). Moreover, all these closure properties can be made "effective": if we know the order and the degree of the coefficients of the diffential equation for $f(x)$ and for $g(x)$, we can (easily) compute bounds for order and coefficient degree of the differential equation for $f+g$, $f\cdot g$, etc.

Moreover, it turns out that the (Taylor) coefficient sequence of a holonomic generating function satisfies a linear recurrence with polynomial coefficients, i.e., is P-recursive, and the P-recursive sequences are precisely the coefficient sequences of holonomic generating functions.

Thus, to find such a recurrence (or differential equation), it is often easiest to use gfun for Maple by Bruno Salvy and Paul Zimmermann, or the Mathematica equivalent by Mallinger (I think). Unfortunately, the FriCAS package described in 1 only does the guessing part, i.e., you would need to compute the bounds yourself and then check. In the case at hand the results are below.

However, you also asked, whether the solution is hypergeometric. To check this, you simply feed the recurrence you found below into Petkovsek's program Hyper, it will tell you whether there is a hypergeometric solution. (most probably no, because if the degree of the coefficient polynomials of the hypergeometric solution are not huge, guessPRec and guessHolo would have found it.)

In case you are dealing with orthogonal polynomials, the Askey Wilson scheme by Koekoek and Swarttouw is a great reference to find the basic information.

```(1) -> guessHolo(cons(x, [(legendreP(n, x)-(1-1/n)*legendreP(n-2, x)) for n in 2..30]), variableName==t)

   (1)
   [
     [
         n
       [t ]f(t):
                 4     2  2     5     3           4     2  ,,
           ((- 2t  - 2t )x  + (t  + 6t  + t)x - 2t  - 2t )f  (t)

         + 
                 3       2      4      2           3       ,
           ((- 3t  - 7t)x  + (3t  + 15t  + 2)x - 8t  - 2t)f (t)

         + 
              2      2     3            2
           ((t  - 3)x  + (t  + 3t)x - 4t  + 2)f(t)
           =
           0
       ,
                    2           2 3      2       3 4      3 2     3
                3t x  - 2t   15t x  - 13t x   35t x  - 39t x  + 6t       4
      f(t)= x + ---------- + -------------- + --------------------- + O(t )]
                     2              6                   8
     ]
                                              Type: List(Expression(Integer))
(2) -> guessPRec cons(x, [(legendreP(n, x)-(1-1/n)*legendreP(n-2, x)) for n in 2..30])

   (2)
   [
     [
       f(n):
                 4      3      2             2     4      3      2
             ((4n  + 28n  + 67n  + 63n + 18)x  - 4n  - 28n  - 68n  - 68n - 24)
          *
             f(n + 2)
         + 
                    4      3       2              3
               (- 8n  - 52n  - 118n  - 107n - 30)x
             + 
                  4      3       2
               (8n  + 52n  + 120n  + 114n + 36)x
          *
             f(n + 1)
         + 
             4      3      2             2     4      3      2
         ((4n  + 24n  + 51n  + 46n + 15)x  - 4n  - 24n  - 52n  - 48n - 16)f(n)
           =
           0
       ,
                       2
                     3x  - 2
      f(0)= x, f(1)= -------]
                        2
     ]
                                              Type: List(Expression(Integer))
```
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 12, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9291625022888184, "perplexity_flag": "middle"}