# Doubt about commutator of operators

I have a doubt regarding commutator algebra. I've seen this expression $$[A,B^n] = nB^{n-1} [A,B]\tag{1}$$ and have used this often for position and momentum operators. However, I want to know when is this valid.

For example, in the case of angular momentum operators, let us evaluate the following: $$[L_x, L_y^2]$$

The previous expression leads us to believe that the answer would be $$2L_y[L_x, L_y] = 2i\hbar L_yL_z$$. However I'm sure this is incorrect.

The correct answer would be $$[L_x,{L_y}^2] = [L_x,{L_y}L_y] = [L_x,{L_y}]L_y + L_y[L_x,{L_y}] = i\hbar L_zL_y + i\hbar L_yL_z\tag{2}$$

My question is, the first expression (1) is valid only when the commutator of two operators is a constant. Is (1) nothing but a special case of the general case that I've used to get the correct answer?

The relation $$[A, B^n] = n B^{n-1}[A,B]$$ is only true when $$B$$ commutes with $$[A,B]$$. (Note, however, that $$A$$ need not commute with $$[A,B]$$.)
Therefore, it cannot be used to evaluate the expression in your example. In particular, in your example, $$A = L_x$$ and $$B= L_y$$, and therefore $$[L_x, L_y] = i\hbar L_z,$$ meaning that $$[B,[A,B]] = i\hbar [L_y, L_z] \neq 0.$$