# Having trouble interpreting the results DSolve gives for the Laguerre equation

I am trying to solve a second order ODE using Mathematica. Before I get into solving my (more complicated) problem, I am trying to use DSolve on known ODEs to check that the answer that Mathematica returns is what I expect.

Wolfram MathWorld lists the Laguerre differential equation as

$\quad \quad x y'' + (1 - x)y' + \lambda y = 0$

But then when I input

DSolve[x*y''[x] + (1 - x)*y'[x] + y[x] == 0, y[x], x]


I get in return

{{y[x] -> (-1 + x) C[1] +
C[2] (-E^x - ExpIntegralEi[x] + x ExpIntegralEi[x])}}


Which at first glance looks nothing like the form of the Laguerre polynomials. Then, when I ask Mathematica,

?ExpIntegralEi


It tells me simply

ExpIntegralEi[z] gives the exponential integral function Ei(z).

And there is no further information on the function Ei(z).

Now, my first guess would be that Ei(z) is just the Mathematica syntax for $e^{iz}$. But I still don't see how that relates to the Laguerre Polynomials, outside of the chance that the constants $C[1]$ and $C[2]$ could be, themselves, functions of x, and therefore could be the Lageurre polynomials.

So my first question is, "What the heck am I doing wrong?". But more specifically, I would like to know what I need to do to this expression to get the answer I'm looking for, and why it is that Mathematica is currently giving me nonsense (or so I think).

In general, I wonder if Mathematica is properly equipped and optimized to solve such ODEs (or to put it another way, perhaps using Mathematica is not the optimal route, and I would be better served trying to tackle the problem in, say, Matlab, for example).

• The Laguerre polynomial solution to this DE is LaguerreL[1, x], which is the polynomial 1 - x, i.e. the negative of the one multiplied by C[1]. Commented May 8, 2015 at 0:38
• Okay, so Mathematica returns the first Laguerre polynomial as a possible solution. But is it not true that any Laguerre polynomial is a solution to the above DE? Why does it not give any information indicating that is the case? And I am still no closer to figuring out what is going on with the ExpIntegralEi[] functions... Thank you for your help, though! It's good to know I'm not totally wrong here... Commented May 8, 2015 at 0:52
• Try DSolve[x*y''[x] + (1 - x)*y'[x] + λ y[x] == 0, y[x], x]. The LaguerreL is one of the two independent solutions and the ExponentialEi term is another for the case λ == 1. Also try executing LaguerreL[1, x]. Commented May 8, 2015 at 0:56
• Excellent! Now I get {{y[x] -> C[1] HypergeometricU[-B, 1, x] + C[2] LaguerreL[B, x]}} which is just the general solution expressed in terms of a linear combination of the two independent solutions. Commented May 8, 2015 at 1:00
• The symbolic constants are independent of the independent variable, that is to say, they cannot be functions of x. Commented May 8, 2015 at 2:44

You really need to know the mathematics you are dealing with as well as the related areas of Mathematica to understand what is going on. If you had read the MathWorld article carefully and looked up Laguerre in the Documentation Center (as I did) you would realize that you have done nothing wrong; you code is finding what you are looking for. You just don't realize you are getting a more general solution than you were expecting.

The general solution has two parts: a confluent hypergeometric function of the first kind and a Laquerre polynonial. In your solution, C[2] is the multiplier for the hypergeometric part, so you can ignore by setting C[2] to zero. C[1] should be set to (-1)^k/k! for the k-th polynomial

laguerre[k_] :=
Collect[(DSolve[x*y''[x] + (1 - x)*y'[x] + k y[x] == 0, y[x], x] /.
{C[1] ->((-1)^k/k!), C[2] -> 0})[[1, 1, 2]], x]
a = Table[laguerre[i], {i, 3}]

{1 - x, 1 - 2 x + x^2/2, 1 - 3 x + (3 x^2)/2 - x^3/6}


To check that this is correct, I will use the built-in functionLaguerreL.

b = Table[LaguerreL[i, x], {i, 3}]

 {1 - x, 1/2 (2 - 4 x + x^2), 1/6 (6 - 18 x + 9 x^2 - x^3)}

Simplify[a - b]

 {0, 0, 0}