Let $k$ be a field . Let $P(X) \in k[X]$ be a monic polynomial of degree $2$ which is not a perfect square in $ \bar k[X]$ i.e. $P(X)$ has no repeated roots in $\bar k$ , where $\bar k$ denotes the algebraic closure of $k$.
Let $D : k[[X]] \to k[[X]]$ be the usual derivation map i.e. $D (\sum_{n=0}^\infty a_nX^n)=\sum_{n=1}^\infty n a_n X^{n-1}$ . So then $P(D) : k[[X]] \to k[[X]]$ is also a $k$-linear map. Can we explicitly determine $\ker P(D)$ ?
Here $k[[X]]$ denotes the power series ring in one variable over $k$.
If it is helpful, you may assume $[\bar k : k] \le 2$
You are trying to solve the differential equation $$\frac{d^2 y}{d x^2} + a \frac{d y}{d x} + b = 0,$$ which, on the level of power series is
$$n (n-1) a_n + a (n-1) a_{n-1 }+ b a_{n-2} = 0,$$ for $n \geq 2.$
Otherwise, if the roots of $P$ are real, this will be a linear combination of two exponentials, otherwise of sines and cosines.