Question about commutators acting on wavefunctions

Consider a commutator acting on a 1D wavefunction: $$[\frac{\hbar}{i} \frac{d}{dx},x]\psi(x)=(\frac{\hbar}{i} \frac{d}{dx}x-x\frac{\hbar}{i} \frac{d}{dx})\psi(x).$$

Now does this mean

1. $$\frac{\hbar}{i} (\frac{d}{dx}x) \psi(x)-x\frac{\hbar}{i} \frac{d}{dx} \psi(x)$$ or
2. $$\frac{\hbar}{i} (\frac{d}{dx}x \psi(x))-x\frac{\hbar}{i} \frac{d}{dx} \psi(x)?$$

In the first cast $$\frac{d}{dx}$$ only acts on $$x$$. In the second case $$\frac{d}{dx}$$ acts on $$x\psi (x)$$. Which is correct?

• Related: physics.stackexchange.com/q/55773/2451 and links therein. – Qmechanic May 8 '19 at 14:09
• Note on formatting : if you need larger brackets try using "\left(" and "\right)" and similar for other bracket types. – StephenG May 8 '19 at 16:36

The only sensible interpretation is the second one: any operator like $$P$$ or $$X$$ acts on whatever is to its right. For instance in linear algebra, if we have two matrices/operators $$A,B$$ and a vector $$v$$, then $$ABv$$ really means $$A(B(v))$$ and likewise $$[A,B]v = ABv - BAv = A(B(v)) - B(A(v)).$$ In your case, you can check this easily. One the one hand we have the famous commutator $$[-i\hbar \frac{d}{d x}, x] = -i \hbar.$$ Interpretation (1) is not consistent with the above formula; interpretation (2) is.
• Regarding your matrices/vector argument, we can also represent wavefunctions/vectors as a Nx1 matrix, and by the associative property of matrices, $A(Bv)=(AB)v$. So $A$ can only act on $B$ instead of $Bv$. How does one resolve this problem? – TaeNyFan May 8 '19 at 14:18
• It's a moot point since matrix multiplication is associative; in this case $(AB)(v) = A(B(v))$. In general you shouldn't think of matrix multiplication as an operator "acting on" something. Operators (matrices) can only act on states (vectors). – Hans Moleman May 8 '19 at 14:21