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?