I was trying to show that: $$[\hat{x}^n,\hat{p}]= i \hbar n \hat{x}^{n-1}.$$
I know from the definition of a pair of a commutator in QM they act on a wave function like this:
$$[\hat A, \hat B] = \hat A \hat B - \hat B \hat A$$
So.. in order to prove this, I apply it some arbitrary wave function $\Psi$ and pull the lever.. (albeit apparently improperly)
$$(\hat p \hat x^n - \hat x^n \hat p )\Psi$$
$$-i \hbar \frac{d}{dx}(x^n\Psi) + ix^n\hbar \frac{d}{dx}(\Psi)$$
Now, the reason why I can't put the $x^n$ in what the derivative operator is applying on the term on the right.. is that because we're assuming that the commutator is not commutative? I thought this applied to the operators themselves, not the resultant function due to those operators. Basically, I thought that while
$$[\hat A, \hat B] = \hat A \hat B - \hat B \hat A$$
is not commutative, i.e. that $\hat A \hat B \ne \hat B \hat A$
it isn't apparent to me, then, that
$$-i \hbar \frac{d}{dx}(x^n\Psi) + ix^n\hbar \frac{d}{dx}(\Psi)$$
is also not commutative.
The first are operators, the second are elements of a field where associativity is a thing. Let me know if anything about my question is confusing.