Eigenfunction expansion of a heat equation with Legendre polynomials I am trying to solve the following PDE by performing an eigenfunction expansion:
$$
\frac{\partial p}{\partial t} = -\cos \varphi \frac{\partial p}{\partial x} + D\frac{\partial^2 p}{\partial \varphi^2}. 
$$
I perform the standard procedure of separation of variables and write $p(x,\varphi,t)=X(x)\Phi(\varphi)T(t)$. This should yield (if I have not mistaken)
$$
\frac{dT}{dt} = \lambda_1 T \\
\frac{dX}{dx} = \lambda_2 X \\
\frac{d^2 \Phi}{d\varphi^2}  = \frac{1}{D}(\lambda_1+\lambda_2 \cos \varphi)\Phi 
$$
By performing a variable substitution $u=\cos \varphi$, the third equation becomes
$$
(1-u^2)\frac{d^2\Phi}{du^2} - u\frac{d\Phi}{du}-\frac{1}{D}(\lambda_1+\lambda_2 u)\Phi=0.
$$
This reminds me of the associated Legendre equation
$$
(1-x^2)P''(x)-2xP'(x)-\frac{m^2}{1-x^2}P(x)+l(l+1)P(x)=0
$$
Still they have some difference, for example the lack of prefactor 2 before the first derivative, and also the term $\lambda_2 u\Phi$. Is it possible to somehow get the solution of $\Phi$ in terms of Legendre polynomials?
Feel free to check any possible algebraic mistakes I made. I make them quite often.
 A: The equation for $\Phi$ is actually Mathieu's equation. The standard form of the equation is
$$
\frac{d^2 y}{dx^2} + (a - 2 q \cos(2x)) y = 0.
$$
If we take the substitution $v = 2 x$, the resulting equation will have the same form as the one you have.
Next allow me to summarize some properties of Mathieu's equation that might be useful to you.
While solutions to Mathieu's equation exist for arbitrary values of $a$ and $q$, only at special values of $a$ and $q$ are there periodic solutions.
(Judging by the substitution $u = \cos\varphi$ you attempted, I'm guessing that you are looking for solutions periodic in $\varphi$.)
Usually $q$ is treated as the free parameter, and the corresponding values of $a$ are arranged in two sequences, $a_n(q)$ and $b_n(q)$. (The index usually starts at $0$ for $a_n$, and $1$ for $b_n$.) You can think of $a_n$ and $b_n$ as eigenvalues of the differential operator $\partial_x^2 - 2 q \cos(2x)$ on $[-\pi, \pi]$.
The eigenfunctions corresponding to $a_n$ are even functions that are analogues to cosines, denoted $\operatorname{ce}_n(x, q)$, and  $\operatorname{se}_n(x, q)$, those corresponding to $b_n$, are sine-like odd functions. The periodicity of these functions alternates as $n$ increases. When $n$ is odd, they are $2\pi$-periodic, but when $n$ is even, the period is $\pi$. This is important for your application, because when we made the change of variables to $v = 2x$, we are effectively only considering the $\pi$-periodic Mathieu functions, i.e. $\operatorname{ce}_{2n}$ and $\operatorname{se}_{2n}$.
Finally, to properly answer your question "is it possible to somehow get the solution of $\Phi$ in terms of Legendre polynomials", I don't think it is. While associated Legendre polynomials can be expressed in terms of hypergeometric functions, the Wikipedia page linked above argues that Mathieu functions cannot.
