# Dsolve gives linearly dependent solutions

I tried using Mathematica 11 to solve a Sturm-Liouville problem:

DSolve[{r f''[r] + f'[r] - r^3 f[r] + (4 k - 2 ) r f[r] == 0},
f[r], {r, 0, \[Infinity]},
Assumptions -> k \[Element] Integers && k <= 0]


But I got two linearly dependent solutions:

{{f[r] ->
Sqrt[2] E^(r^2/2) (C[1] HypergeometricU[k, 1, -r^2] + C[2] LaguerreL[-k, -r^2])}}


(It is true that for non-negative integer values of a:

 LaguerreL[a , z] = C(a) HypergeometricU[-a, 1, z]


Where C(a) is some constant, so the solutions really are the same...)

I don't know if it is relevant, but this equation is a special case of a more complicated one from which I started, in which I got 2 linearly independent solutions, both of which converged to this identical solution above. That equation was:

DSolve[r f''[r] + f'[r] - b^2 r^-1 f[r] - r^3 f[r] + k r f[r] == 0,
f[r], {r, 0, \[Infinity]}]


And it reduces to the problematic equation by taking b->0

What did I do wrong?

Thanks!

Assumptions on negative k are not used.

You get same solution without the assumption (I think using assumptions with DSolve does not always go through, or are ignored), there are number of posts related to this.

DSolve[{r f''[r]+f'[r]-r^3 f[r]+(4 k-2) r f[r]==0},f[r],r,
Assumptions->Element[k,Integers]&&k<=0]


You get same solution without the assumption on k

DSolve[{r f''[r] + f'[r] - r^3 f[r] + (4 k - 2 ) r f[r] == 0}, f[r], r]


To check for L.I. using the Wronskian

f1 = (Sqrt[2]*E^(r^2/2)*Sqrt[r^2]*HypergeometricU[k, 1, -r^2])/r
f2 = (Sqrt[2]*E^(r^2/2)*Sqrt[r^2]*LaguerreL[-k, -r^2])/r;
mat = {{f1, f2}, {D[f1, r], D[f2, r]}};
w = Det[mat]


Now we can look at L.I. or not for different k.

 Plot[w /. k -> 1, {r, 0, 5}]


Not zero. Hence L.I. for positive k.

  Plot[w /. k -> -1, {r, 0, 5}]


But for negative k they are L.D.

The whole point is that assumptions on k are not used when finding the solution.

Compare to Maple solution, which also behaves the same way, but in reverse. Maple gives two L.I. solutions for negative k but not for positive k.

Maple gives this solution to the ODE

But the Wronskian is zero for positive k and non-zero for positive k.

So if you want solution for negative k, use Maple's solution. For positive k, use Mathematica's solution.

Assumptions on k do not change the solution either in Maple, just like with Mathematica. So I do not think this is a bug.