I am reading Solid State Physics Essential Concepts by David W. Snoke when I encounter this relation $$[A,f(B)]=[A,B]f^\prime(B),\tag{4.4.15}$$ which is labled (4.4.15) in page 226. Snoke didn't give any proof of it, nor did he give any restrictions of this formula.
I tried to prove it at the first time but failed. Then I realized it is too good to be true. But I do know in some cases it holds. For example, suppose we have the simple operator $\hat{v}=\frac{\hat{p}}{m}$, and we try to calculate $e^{-ik\hat{r}}\hat{v}e^{ik\hat{r}}$. If we use this formula, the deduction is straightforward and the result is right.
But when we try to calculate the result of $e^{-ik\hat{r}}\hat{H}e^{ik\hat{r}}$, where $\hat{H}=\frac{\hat{p}^2}{2m}+V(\hat{r})$, this formula leads us to wrong answer.
So maybe this formula holds in some cases? Do you have any idea about proving it under some constrictions?