Deriving iterative applications of an operator using recursion In this answer by Angina Seng, they start with the proposition that:
$$ P^n = \sum_{k=1}^n a_{n,k} x^k D^k$$
Why were they able to do this? Is there any easy justification to give for it?
 A: It's a general fact about the Weyl algebra $k[x, D]$ (where $D = \partial_x$) that every element can be written this way. The proof is just by induction; you apply the canonical commutation relation $D x - x D = 1$ a lot to move $x$'s past $D$'s. As a simple example,
$$(xD)^2 = x(Dx)D = x(xD + 1)D = x^2 D^2 + xD.$$
In general, it suffices to show that $D^i x^j$ can be written as a sum of terms of the form $x^k D^{\ell}$, which you do by commuting the $k$ copies of $x$ past the $j$ copies of $D$ using the canonical commutation relation. It will be convenient to adopt the notation $[X, Y] = XY - YX$ and to prove lemmas about it, e.g. that it's a derivation in each variable, and a lemma about what $[X, Y^n]$ looks like.
Abstractly you can get this out of the Poincare-Birkhoff-Witt theorem, applied to the universal enveloping algebra of the Heisenberg algebra $\text{span}(x, D, 1)$. (You then need to take a quotient of the universal enveloping algebra given by setting $1$ to the identity to get the Weyl algebra.)
