Computing the product $(\frac{d}{dx}+x)^n(-\frac{d}{dx}+x)^n$

I want to compute the product $$ (\frac{d}{dx}+x)^n(-\frac{d}{dx}+x)^n, $$ for a natural number $n$. For $n$ equal to 0 or 1, the computation is very simple but for such a low number as 2 the brute force calculation begins to be rather cumbersome and I cannot see any pattern emerging. I tried to find some connection with the Rodrigues' formula for the Hermite polynomials but I could not.

These operators come up in the algebraic approach to the quantum harmonic oscillator.

Explicit Example

To avoid any misunderstanding, I am going to show explicitly the computation for the case $n=1$: $$ (\frac{d}{dx}+x)(-\frac{d}{dx}+x)=-\frac{d^2}{dx^2}+1+x\frac{d}{dx}-x\frac{d}{dx}+x^2=-\frac{d^2}{dx^2}+x^2+1. $$

One can think of a function $f$ the operators are acting on. For example, $$ (\frac{d}{dx}\circ x) f= (\frac{d}{dx}x)f+x\frac{d}{dx}f=(1+\frac{d}{dx})f, $$ then $$ \frac{d}{dx}\circ x=1+x\frac{d}{dx} $$


Just some Sage-generated data to play around with:

For $n = 0$, the result is $ 1 $.

For $n = 1$, the result is $ -\frac{\partial^{2}}{\partial x^{2}} + x^{2} + 1 $.

For $n = 2$, the result is $ \frac{\partial^{4}}{\partial x^{4}} - 2 x^{2} \frac{\partial^{2}}{\partial x^{2}} - 4 \frac{\partial^{2}}{\partial x^{2}} - 4 x \frac{\partial}{\partial x} + x^{4} + 4 x^{2} + 1 $.

For $n = 3$, the result is $ -\frac{\partial^{6}}{\partial x^{6}} + 3 x^{2} \frac{\partial^{4}}{\partial x^{4}} + 9 \frac{\partial^{4}}{\partial x^{4}} + 12 x \frac{\partial^{3}}{\partial x^{3}} - 3 x^{4} \frac{\partial^{2}}{\partial x^{2}} - 18 x^{2} \frac{\partial^{2}}{\partial x^{2}} - 9 \frac{\partial^{2}}{\partial x^{2}} - 12 x^{3} \frac{\partial}{\partial x} - 36 x \frac{\partial}{\partial x} + x^{6} + 9 x^{4} + 9 x^{2} - 3 $.

For $n = 4$, the result is $ \frac{\partial^{8}}{\partial x^{8}} - 4 x^{2} \frac{\partial^{6}}{\partial x^{6}} - 16 \frac{\partial^{6}}{\partial x^{6}} - 24 x \frac{\partial^{5}}{\partial x^{5}} + 6 x^{4} \frac{\partial^{4}}{\partial x^{4}} + 48 x^{2} \frac{\partial^{4}}{\partial x^{4}} + 42 \frac{\partial^{4}}{\partial x^{4}} + 48 x^{3} \frac{\partial^{3}}{\partial x^{3}} + 192 x \frac{\partial^{3}}{\partial x^{3}} - 4 x^{6} \frac{\partial^{2}}{\partial x^{2}} - 48 x^{4} \frac{\partial^{2}}{\partial x^{2}} - 36 x^{2} \frac{\partial^{2}}{\partial x^{2}} + 48 \frac{\partial^{2}}{\partial x^{2}} - 24 x^{5} \frac{\partial}{\partial x} - 192 x^{3} \frac{\partial}{\partial x} - 216 x \frac{\partial}{\partial x} + x^{8} + 16 x^{6} + 42 x^{4} - 48 x^{2} - 39 $.

For $n = 5$, the result is $ -\frac{\partial^{10}}{\partial x^{10}} + 5 x^{2} \frac{\partial^{8}}{\partial x^{8}} + 25 \frac{\partial^{8}}{\partial x^{8}} + 40 x \frac{\partial^{7}}{\partial x^{7}} - 10 x^{4} \frac{\partial^{6}}{\partial x^{6}} - 100 x^{2} \frac{\partial^{6}}{\partial x^{6}} - 130 \frac{\partial^{6}}{\partial x^{6}} - 120 x^{3} \frac{\partial^{5}}{\partial x^{5}} - 600 x \frac{\partial^{5}}{\partial x^{5}} + 10 x^{6} \frac{\partial^{4}}{\partial x^{4}} + 150 x^{4} \frac{\partial^{4}}{\partial x^{4}} + 150 x^{2} \frac{\partial^{4}}{\partial x^{4}} - 150 \frac{\partial^{4}}{\partial x^{4}} + 120 x^{5} \frac{\partial^{3}}{\partial x^{3}} + 1200 x^{3} \frac{\partial^{3}}{\partial x^{3}} + 1800 x \frac{\partial^{3}}{\partial x^{3}} - 5 x^{8} \frac{\partial^{2}}{\partial x^{2}} - 100 x^{6} \frac{\partial^{2}}{\partial x^{2}} - 150 x^{4} \frac{\partial^{2}}{\partial x^{2}} + 1500 x^{2} \frac{\partial^{2}}{\partial x^{2}} + 975 \frac{\partial^{2}}{\partial x^{2}} - 40 x^{7} \frac{\partial}{\partial x} - 600 x^{5} \frac{\partial}{\partial x} - 1800 x^{3} \frac{\partial}{\partial x} - 600 x \frac{\partial}{\partial x} + x^{10} + 25 x^{8} + 130 x^{6} - 150 x^{4} - 975 x^{2} - 255 $.

For $n = 6$, the result is $ \frac{\partial^{12}}{\partial x^{12}} - 6 x^{2} \frac{\partial^{10}}{\partial x^{10}} - 36 \frac{\partial^{10}}{\partial x^{10}} - 60 x \frac{\partial^{9}}{\partial x^{9}} + 15 x^{4} \frac{\partial^{8}}{\partial x^{8}} + 180 x^{2} \frac{\partial^{8}}{\partial x^{8}} + 315 \frac{\partial^{8}}{\partial x^{8}} + 240 x^{3} \frac{\partial^{7}}{\partial x^{7}} + 1440 x \frac{\partial^{7}}{\partial x^{7}} - 20 x^{6} \frac{\partial^{6}}{\partial x^{6}} - 360 x^{4} \frac{\partial^{6}}{\partial x^{6}} - 540 x^{2} \frac{\partial^{6}}{\partial x^{6}} + 120 \frac{\partial^{6}}{\partial x^{6}} - 360 x^{5} \frac{\partial^{5}}{\partial x^{5}} - 4320 x^{3} \frac{\partial^{5}}{\partial x^{5}} - 8280 x \frac{\partial^{5}}{\partial x^{5}} + 15 x^{8} \frac{\partial^{4}}{\partial x^{4}} + 360 x^{6} \frac{\partial^{4}}{\partial x^{4}} + 450 x^{4} \frac{\partial^{4}}{\partial x^{4}} - 9000 x^{2} \frac{\partial^{4}}{\partial x^{4}} - 6525 \frac{\partial^{4}}{\partial x^{4}} + 240 x^{7} \frac{\partial^{3}}{\partial x^{3}} + 4320 x^{5} \frac{\partial^{3}}{\partial x^{3}} + 15600 x^{3} \frac{\partial^{3}}{\partial x^{3}} + 7200 x \frac{\partial^{3}}{\partial x^{3}} - 6 x^{10} \frac{\partial^{2}}{\partial x^{2}} - 180 x^{8} \frac{\partial^{2}}{\partial x^{2}} - 540 x^{6} \frac{\partial^{2}}{\partial x^{2}} + 9000 x^{4} \frac{\partial^{2}}{\partial x^{2}} + 31050 x^{2} \frac{\partial^{2}}{\partial x^{2}} + 9180 \frac{\partial^{2}}{\partial x^{2}} - 60 x^{9} \frac{\partial}{\partial x} - 1440 x^{7} \frac{\partial}{\partial x} - 8280 x^{5} \frac{\partial}{\partial x} - 7200 x^{3} \frac{\partial}{\partial x} + 8100 x \frac{\partial}{\partial x} + x^{12} + 36 x^{10} + 315 x^{8} - 120 x^{6} - 6525 x^{4} - 9180 x^{2} - 855 $.

Sage code:

A.<x> = DifferentialWeylAlgebra(QQ)
x, dx = A.gens()

def r(n):
    return (dx + x) ** n * (-dx + x) ** n

for i in range(7):
    print "For $n = " + str(i) + "$, the result is $" + latex(r(i)) + "$.\r\n"

Note that it is easily seen that $\left[\dfrac{\partial}{\partial x} + x, - \dfrac{\partial}{\partial x} + x\right] = 2$. Thus, the operators $\dfrac{\partial}{\partial x} + x$ and $- \dfrac{\partial}{\partial x} + x$ themselves generate an isomorphic copy of the Weyl algebra, except for a scalar factor of $2$.


Similar numbers appear in Table X(b) of Cayley, Tables of the symmetric functions of the roots, to the degree $10$, for the form $1+bx+\dfrac{cx^2}{1.2}+\ldots=\left(1-\alpha x\right)\left(1-\beta x\right)\left(1-\gamma x\right)\cdots$ .


In view of the relation $\left[\dfrac{\partial}{\partial x} + x, - \dfrac{\partial}{\partial x} + x\right] = 2$, perhaps the following copypasta from some of my old homework will come useful.

Let $\mathbb{N} = \left\{0,1,2,\ldots\right\}$.

Now we need an easy fact from quantum algebra:

Proposition 1. Let $A$ be a ring (not necessarily commutative). Let $x\in A$ and $y\in A$ be such that $xy-yx=1$. Then, for each integer $n \geq 0$, we have \begin{align} \left( xy\right) ^{n}=\sum\limits_{k=0}^{n} \genfrac{\{}{\}}{0pt}{0}{n+1}{k+1} y^{k}x^{k}, \end{align} where the curly braces denote Stirling numbers of the second kind.

Proof of Proposition 1. First of all, it is easy to see that \begin{equation} x^{m}y=mx^{m-1}+yx^{m}\ \ \ \ \ \ \ \ \ \ \text{for every }m\in\mathbb{N} \label{darij1.pf.xy-yx.1} \tag{1} \end{equation} (this allows $m=0$ if $0x^{0-1}$ is interpreted as $0$). Indeed, the proof of \eqref{darij1.pf.xy-yx.1} proceeds by induction over $m$ and is straightforward enough to be left to the reader.

We will now prove Proposition 1 by induction over $n$. The induction base is obvious, so we step to the induction step:

Let $n>0$. Assuming that $\left( xy\right) ^{n-1}=\sum\limits_{k=0}^{n-1} \genfrac{\{}{\}}{0pt}{0}{n}{k+1} y^{k}x^{k}$, we need to show that $\left( xy\right) ^{n}=\sum\limits_{k=0} ^{n} \genfrac{\{}{\}}{0pt}{0}{n+1}{k+1} y^{k}x^{k}$.

We have \begin{align*} \left( xy\right) ^{n} & =\left( xy\right) ^{n-1}xy=\left( \sum\limits_{k=0}^{n-1} \genfrac{\{}{\}}{0pt}{0}{n}{k+1} y^{k}x^{k}\right) xy\ \ \ \ \ \ \ \ \ \ \left( \text{since }\left( xy\right) ^{n-1}=\sum\limits_{k=0}^{n-1} \genfrac{\{}{\}}{0pt}{0}{n}{k+1} y^{k}x^{k}\right) \\ & =\sum\limits_{k=0}^{n-1} \genfrac{\{}{\}}{0pt}{0}{n}{k+1} y^{k}\underbrace{x^{k}x}_{=x^{k+1}}y=\sum\limits_{k=0}^{n-1} \genfrac{\{}{\}}{0pt}{0}{n}{k+1} y^{k}\underbrace{x^{k+1}y}_{\substack{=\left( k+1\right) x^{k} +yx^{k+1}\\\text{(by \eqref{darij1.pf.xy-yx.1}, applied to }m=k+1\text{)}}}\\ & =\sum\limits_{k=0}^{n-1} \genfrac{\{}{\}}{0pt}{0}{n}{k+1} y^{k}\left( \left( k+1\right) x^{k}+yx^{k+1}\right) \\ & =\sum\limits_{k=0}^{n-1} \genfrac{\{}{\}}{0pt}{0}{n}{k+1} \left( k+1\right) y^{k}x^{k}+\sum\limits_{k=0}^{n-1} \genfrac{\{}{\}}{0pt}{0}{n}{k+1} \underbrace{y^{k}y}_{=y^{k+1}}x^{k+1}\\ & =\sum\limits_{k=0}^{n-1} \genfrac{\{}{\}}{0pt}{0}{n}{k+1} \left( k+1\right) y^{k}x^{k}+\sum\limits_{k=0}^{n-1} \genfrac{\{}{\}}{0pt}{0}{n}{k+1} y^{k+1}x^{k+1}\\ & =\sum\limits_{k=0}^{n-1} \genfrac{\{}{\}}{0pt}{0}{n}{k+1} \left( k+1\right) y^{k}x^{k}+\sum\limits_{k=1}^{n} \genfrac{\{}{\}}{0pt}{0}{n}{k} y^{k}x^{k}\\ & \ \ \ \ \ \ \ \ \ \ \left( \text{here, we substituted }k-1\text{ for }k\text{ in the second sum}\right) \\ & =\sum\limits_{k=0}^{n} \genfrac{\{}{\}}{0pt}{0}{n}{k+1} \left( k+1\right) y^{k}x^{k}+\sum\limits_{k=0}^{n} \genfrac{\{}{\}}{0pt}{0}{n}{k} y^{k}x^{k}\\ & \ \ \ \ \ \ \ \ \ \ \left( \begin{array}[c]{c} \text{here, we extended both sums by zero terms, using the fact}\\ \text{that } \genfrac{\{}{\}}{0pt}{0}{n}{n+1} = \genfrac{\{}{\}}{0pt}{0}{n}{0} =0\text{ whenever }n>0 \end{array} \right) \\ & =\sum\limits_{k=0}^{n}\underbrace{\left( \genfrac{\{}{\}}{0pt}{0}{n}{k+1} \left( k+1\right) + \genfrac{\{}{\}}{0pt}{0}{n}{k} \right) }_{\substack{= \genfrac{\{}{\}}{0pt}{0}{n+1}{k+1} \\\text{(by the recursion formula for Stirling numbers}\\\text{of the second kind)}}}y^{k}x^{k}\\ & =\sum\limits_{k=0}^{n} \genfrac{\{}{\}}{0pt}{0}{n+1}{k+1} y^{k}x^{k}. \end{align*} This completes the induction step, and thus the inductive proof of Proposition 1. $\blacksquare$

Proposition 2. Let $A$ be a ring (not necessarily commutative). Let $x\in A$ and $y\in A$ be such that $xy-yx=1$. Then, for each integer $n \geq 0$, we have \begin{align} \left( yx\right) ^{n}=\sum\limits_{k=0}^{n} \genfrac{\{}{\}}{0pt}{0}{n}{k} y^{k}x^{k}, \end{align} where the curly braces denote Stirling numbers of the second kind.

Proof of Proposition 2. Just as in the proof of Proposition 1, we show that \eqref{darij1.pf.xy-yx.1} holds.

We will now prove Proposition 2 by induction over $n$. The induction base is obvious, so we step to the induction step:

Let $n>0$. Assuming that $\left( yx\right) ^{n-1}=\sum\limits_{k=0}^{n-1} \genfrac{\{}{\}}{0pt}{0}{n-1}{k} y^{k}x^{k}$, we need to show that $\left( yx\right)^{n} = \sum\limits_{k=0}^{n} \genfrac{\{}{\}}{0pt}{0}{n}{k} y^{k}x^{k}$.

We have \begin{align*} \left( yx\right) ^{n} & =\left( yx\right) ^{n-1}yx=\left( \sum\limits_{k=0}^{n-1} \genfrac{\{}{\}}{0pt}{0}{n-1}{k} y^{k}x^{k}\right) yx\ \ \ \ \ \ \ \ \ \ \left( \text{since }\left( yx\right) ^{n-1}=\sum\limits_{k=0}^{n-1} \genfrac{\{}{\}}{0pt}{0}{n-1}{k} y^{k}x^{k}\right) \\ & =\sum\limits_{k=0}^{n-1} \genfrac{\{}{\}}{0pt}{0}{n-1}{k} y^{k}\underbrace{x^{k}y}_{\substack{=kx^{k-1}+yx^{k}\\\text{(by \eqref{darij1.pf.xy-yx.1}, applied to }m=k\text{)}}}x\\ & =\sum\limits_{k=0}^{n-1} \genfrac{\{}{\}}{0pt}{0}{n-1}{k} y^{k}\left( kx^{k-1}+yx^{k}\right) x\\ & =\sum\limits_{k=0}^{n-1} \genfrac{\{}{\}}{0pt}{0}{n-1}{k} ky^{k}\underbrace{x^{k-1}x}_{=x^{k}}+\sum\limits_{k=0}^{n-1} \genfrac{\{}{\}}{0pt}{0}{n-1}{k} k\underbrace{y^{k}y}_{=y^{k+1}}\underbrace{x^{k}x}_{=x^{k+1}}\\ & =\sum\limits_{k=0}^{n-1} \genfrac{\{}{\}}{0pt}{0}{n-1}{k} ky^{k}x^{k}+\sum\limits_{k=0}^{n-1} \genfrac{\{}{\}}{0pt}{0}{n-1}{k} ky^{k+1}x^{k+1}\\ & =\sum\limits_{k=0}^{n-1} \genfrac{\{}{\}}{0pt}{0}{n-1}{k} ky^{k}x^{k}+\sum\limits_{k=1}^{n} \genfrac{\{}{\}}{0pt}{0}{n-1}{k-1} ky^{k}x^{k}\\ & \ \ \ \ \ \ \ \ \ \ \left( \text{here, we substituted }k-1\text{ for }k\text{ in the second sum}\right) \\ & =\sum\limits_{k=0}^{n} \genfrac{\{}{\}}{0pt}{0}{n-1}{k} ky^{k}x^{k}+\sum\limits_{k=0}^{n} \genfrac{\{}{\}}{0pt}{0}{n-1}{k-1} ky^{k}x^{k}\\ & \ \ \ \ \ \ \ \ \ \ \left( \begin{array}[c]{c} \text{here, we extended both sums by zero terms, using the fact}\\ \text{that } \genfrac{\{}{\}}{0pt}{0}{n-1}{n} = \genfrac{\{}{\}}{0pt}{0}{n-1}{-1} =0\text{ whenever }n>0 \end{array} \right) \\ & =\sum\limits_{k=0}^{n}\underbrace{\left( \genfrac{\{}{\}}{0pt}{0}{n-1}{k} k+ \genfrac{\{}{\}}{0pt}{0}{n-1}{k-1} \right) }_{\substack{= \genfrac{\{}{\}}{0pt}{0}{n}{k} \\\text{(by the recursion formula for Stirling numbers}\\\text{of the second kind)}}}y^{k}x^{k}\\ & =\sum\limits_{k=0}^{n} \genfrac{\{}{\}}{0pt}{0}{n}{k} y^{k}x^{k}. \end{align*} This completes the induction step, and thus the inductive proof of Proposition 2. $\blacksquare$


For convenience let us rewrite $x,\partial_x$ with $a,b$ so $[a,b]=x\partial_x-\partial_x x=-1$ (in the operator sense on the Schwartz space).

Lemma. For all $n\in\mathbb N$ $$ [(a+b)^n,a-b]=2n(a+b)^{n-1} $$

Proof. As darij pointed out, one has $[a+b,a-b]=2$ (i.e. the case $n=1$). The trick then is $$ \begin{split} [(a+b)^{n+1},a-b]&=(a+b)[(a+b)^n,a-b]+[a+b,a-b](a+b)^n\\ &=(a+b)2n(a+b)^{n-1}+2(a+b)^{n}=2(n+1)(a+b)^{(n+1)-1} \end{split} $$ which concludes the proof via induction. $\square$

Proposition. For all $n\in\mathbb N_0$ $$ (a+b)^n(a-b)^n=\prod_{j=1}^n (a^2-b^2+(2j-1)) $$

Proof. ($n=0$ is obvious). Note that $(a-b)(a+b)=a^2-b^2-1$. Using the previous lemma $$ \begin{split} (a+b)^{n+1}(a-b)^{n+1}&=[(a+b)^{n+1},a-b](a-b)^n+(a-b)(a+b)(a+b)^n(a-b)^n\\ &=2(n+1)(a+b)^n(a-b)^n +(a^2-b^2-1)(a+b)^n(a-b)^n\\ &=\big( a^2-b^2+2n+1)(a+b)^n(a-b)^n=\prod_{j=1}^{n+1} (a^2-b^2+(2j-1)) \end{split} $$ which again concludes the proof via induction. $\square$

This result reproduces the cases (aside from $n=0$, obvious)

  • $(a+b)(a-b)=a^2-b^2+1$

  • Making use of $[a^2,b^2]=-4ab-2$ (similar techniques) one gets $$ \begin{split} (a+b)^2(a-b)^2=(a^2-b^2+1)(a^2-b^2+3)&=a^4-a^2b^2-b^2a^2+4a^2-4b^2+b^4+3\\ &=a^4-2a^2b^2-4ab+4a^2-4b^2+b^4+1 \end{split} $$

etc... I feel like this formula is the best thing one can hope for in terms of structure.

Edit: Thanks darij for the +200 rep!


Let $X, Y$ be operators which are central, meaning that $[X,Y] = XY-YX = c$ for some scalar $c$. Then

  1. As a form of binomial theorem, we have

    $$ (X+Y)^n = \sum_{\substack{a,b,m \geq 0 \\ a+b+2m=n}} \frac{n!}{a!b!m!2^m} c^m Y^b X^a = \sum_{a=0}^{n} \binom{n}{a} P_{n-a}(c,Y)X^a, $$

    where $P_n$ is defined by the following sum

    $$P_n(c, x) = \sum_{m=0}^{\lfloor n/2\rfloor} \frac{n!}{(n-2m)!m!2^m} c^m x^{n-2m} = \left( c\frac{d}{dx} + x \right)^n \mathbf{1}. $$

    In particular, if $c = -1$ then $P_n(-1, x) = \operatorname{He}_n(x)$, where $\operatorname{He}_n$ is the probabilists' Hermite polynomial. Similarly, if $c = 1$, then $P_n(1, x) = i^{-n} \operatorname{He}_n(ix)$.

  2. Under the same condition, for any polynomials $f, g$ we have

    $$ f(X)g(Y) = \sum_{m \geq 0} \frac{c^m}{m!} g^{(m)}(Y)f^{(m)}(X). $$

In our case, $[\frac{d}{dx}, x] = 1$, and so, we can use both formulas to give a complicated, but still explicit expression for the product of $(\frac{d}{dx}+x)^n$ and $(-\frac{d}{dx}+x)^n$. Combining altogether,

\begin{align*} &\left( \frac{d}{dx} + x \right)^n \left( -\frac{d}{dx} + x \right)^n \\ &= \sum_{p \geq 0} \frac{1}{p!} \Bigg( \sum_{\substack{a_i, b_i, m_i \geq 0 \\ a_i+b_i+2m_i = n-p}} \frac{(-1)^{a_2+m_2} (n!)^2}{a_1!a_2!b_1!b_2!m_1!m_2!2^{m_1+m_2}} x^{b_1+b_2} \left( \frac{d}{dx} \right)^{a_1+a_2} \Bigg). \end{align*}

The following is a sample Mathematica code, comparing this formula with the actual answer for the case $n = 3$.

Coef[n_, c_, l_] := n!/(l[[1]]! l[[2]]! l[[3]]! 2^l[[3]]) c^l[[3]];
T[n_] := FrobeniusSolve[{1, 1, 2}, n];
(* Compute (x+d/dx) (x-d/dx)^n f(x) *)
n = 3;
Nest[Expand[x # + D[#, x]] &, Nest[Expand[x # - D[#, x]] &, f[x], n], n]
Sum[1/p! Sum[ Sum[ Coef[n, 1, l1] Coef[n, -1, l2]
 (-1)^l2[[2]] x^(l1[[1]] + l2[[1]]) D[f[x], 
 {x, l1[[2]] + l2[[2]]}], {l1, T[n - p]}], {l2, T[n - p]}], {p, 0, n}] // Expand
Clear[n];

Computation