Let $\frac{d}{dx}=D$, one of my exercises shows that the operator $(D^2-1)$ of a function $f(x)$ can be factor as either $(D-1)(D+1)$ or $(D+\tanh x)(D-\tanh x)$.
I understand the first factorization but do not get why it can be factorized as $(D-\tanh x)(D+\tanh x)$? My verification is as follows.
$$(D+\tanh x)(D-\tanh x)=D^2-D(\tanh x)+\tanh x * D-\tanh^2 x=D^2-(1-\tanh^2x)+\tanh x * D-\tanh^2 x=D^2-1+\color{red}{\tanh x*D}.$$
As you can see, there is an additional term (in red). Where I made a mistake?
We assume $D:=\dfrac{d}{dx}$.
One may observe that $$ \begin{align} (D+\tanh )\circ(D-\tanh)\cdot f&=(D+\tanh )\circ\left(f'-\tanh \cdot f\right) \\\\&=f''\color{blue}{-D (\tanh \cdot f)}+\tanh \cdot f'-\tanh^2 \cdot f \\\\&=f''\color{blue}{-(1-\tanh^2) \cdot f-\tanh \cdot f'}+\tanh \cdot f'-\tanh^2 \cdot f \\\\&=f''- f \\\\&=(D^2-1)\cdot f \end{align} $$ as announced.