A question about commutation relation and functional derivatives In wikipedia https://en.wikipedia.org/wiki/Canonical_commutation_relation. In quantum mechanics the Hamiltonian ${\hat {H}}$, (generalized) coordinate $ {\hat {Q}}$ and (generalized) momentum ${\hat {P}}$ are all linear operators.
Further, since the Hamiltonian operator depends on the (generalized) coordinate and momentum operators, it can be viewed as a functional, and we may write (using functional derivatives):
$$[{\hat {H}},{\hat {Q}}]=\frac{\delta \hat{H}}{\delta \hat{P}}\cdot[\hat{P},\hat{Q}]\tag{1}$$
$$[{\hat {H}},{\hat {P}}]=\frac{\delta \hat{H}}{\delta \hat{Q}}\cdot[\hat{Q},\hat{P}]\tag{2}$$
Why do these two equations hold?
 A: There are several issues with OP's mentioned formulas (1) & (2) on the Wikipedia page (December 2021).

*

*For starters a functional derivative (well, any derivative) does not readily make sense for operators wrt. an operator. There are all kinds of operator ordering issues$^1$.

Let us therefore from now on interpret (1) & (2) classically, i.e. remove all operator hats, and replace the commutator with a Poisson bracket.

*

*In the point mechanical case, the functional derivative  in eqs. (1) & (2) is just an ordinary partial derivative.


*In field theory, the canonical variables $Q^i(x)$ and $P_j(x)$ depends of a spatial coordinate $x$. The canonical Poisson bracket then becomes
$$\begin{align} \{Q^i(x),P_j(y)\} ~=~& \delta^i_j \delta^d(x\!-\!y), \cr \{Q^i(x),Q^j(y)\} ~=~&0, \cr \{P_i(x),P_j(y)\} ~=~&0.\end{align} $$
The Hamiltonian
$$H~=~\int_M\! d^dx ~{\cal H}(Q(x),P(x),\partial Q(x),\partial P(x),x)$$
is then a local functional integrated over $x$-space.
The dot in eqs. (1) & (2) presumably stands for a DeWitt condensed notation with an implicit summation and integration over repeated discrete and continuous indices.
In both cases, eqs. (1) & (2) follows from definitions.
--
$^1$ A remedy is in principle to introduce symbols for the operators, and a symbol-operator ordering prescription, e.g. Weyl-ordering, Wick-ordering, etc.
A: The commutation with a conjugate operator does the same thing as a functional derivative. Assume that
$$ [\hat{P}(x_1),\hat{Q}(x_2)] = \delta(x_2-x_1) ~~~ \text{and} ~~~ [\hat{P},\hat{P}] = [\hat{Q},\hat{Q}] = 0 . $$
Then
$$ [\hat{P}^n,\hat{Q}]\cdot F = n \hat{P}^{n-1}\cdot F , $$
where $F$ is some arbitrary function of $x$. On the other hand, for
$$ \frac{\delta\hat{P}(x_2)}{\delta \hat{P}(x_1)} = \delta(x_2-x_1) , $$
we have
$$ \frac{\delta \hat{P}^n}{\delta \hat{P}(x_1)} \cdot F = n \hat{P}^{n-1} \cdot F . $$
Then, assuming $\hat{H}$ is a bivariate polynomial in $\hat{P}$ and $\hat{Q}$, it follows that the right-hand sides and left-hand sides in the two equations would produce the same results.
