I came up with the operator identity in my QM textbook
$$ [X,F(P)]=[X,P]F'(P) $$
where $X,P$ are Hermitian operators whose commutator commutes with them: $$[X,[X,P]]=[P,[X,P]]=0.$$ $F(x)$ is some well-behaved function.
In the book, the identity is proved by verifying $$[X,P^n]=[X,P]nP^{n-1}$$ by induction and then expanding $F(x)$ into power series. However, the identity still works under conditions where this is quite impossible. For example, $$ [X,P^{-2}]=-2[X,P]P^{-3}\\ [X,\sqrt P]=\frac12[X,P]P^{-1/2} $$
is also true at least in some cases. (the second identity requires $P$ to be positive) As for the position and momentum case, it is beyond doubt because in the $p$-representation $X$ is $i\hbar\dfrac{d}{dp}$ and the identities are obvious. But difficulties occur when the commutator is not a constant.
Question Can we prove the identity is indeed true in such cases, or are they actually not true and there are some more restrictions on the function $F(x)$?