# Arguments of specific Hamiltonian, always conserved?

I'm studying an introductory course in theoretical physics, I stumbled upon something I really can't understand.

So, in my book there is written the following statment:

Consider a Hamiltonian system $$S$$, with $$N$$ degrees of freedom. The generalised coordinates are $$q^{1}, q^{2},..,q^{N}$$ and the conjugate momenta are: $$p_1, p_2,..,p_N$$. If the system $$S$$ has the following Hamiltonian: $$\mathcal{H} = \mathcal{H}\left( f_1(q^{1}, p_1), f_2(q^{2}, p_2),.., f_N(q^{N}, p_N) \right)$$ then all the quantities $$f_i(q^{i}, p_i)$$ are conserved.

The result is then used to proof another theorem. I don't understand how all these quantities are conserved? I tried to prove it, but I can't seem to find it.

We have to prove that:

$$\frac{d}{dt}f_i(q^{i}, p_i) = 0$$

I tried this:

$$\frac{d}{dt}f_i(q^{i}, p_i) = \frac{\partial f_i}{\partial q^{i}}\dot{q}^{i} + \frac{\partial f_i}{\partial p_i}\dot{p}_i$$

But I can't get further than this, does anyone know why this derivative had to equal $$0$$?

Note that so far you are only taking the derivative of $$f_i$$ through basic chain rules, without using the fact that you are given a Hamiltonian, which governs the time evolution of variables in this problem.
Thus the next step would be to rewrite $$\dot{q}_i$$ and $$\dot{p}_i$$ with Hamilton's equation. Since $$\dot{q}_i = \frac{\partial H}{\partial p_i}\ ,$$ and by chain rules again, $$\frac{\partial H}{\partial p_i} = \frac{\partial H}{\partial f_i}\frac{\partial f_i}{\partial p_i}\ .$$ Similarly $$\dot{p}_i = - \frac{\partial H}{\partial q_i} = - \frac{\partial H}{\partial f_i} \frac{\partial f_i}{\partial q_i}\ .$$ Plugging these back in, you'll find that the two terms in the derivative neatly cancel.
Hint: If \begin{align} \dot q_i &= \frac{\partial H}{\partial p_i} \\ \dot p_i &= -\frac{\partial H}{\partial q_i} \end{align}
then, for a compltely general $$f$$ and $$H$$, \begin{align} \frac{d}{dt} f &= \sum_{i = 1}^N \left( \dot q_i \frac{\partial f}{\partial q_i} + \dot p_i \frac{\partial f}{\partial p_i} \right) \\ &= \sum_{i = 1}^N \left( \frac{\partial H}{\partial p_i} \frac{\partial f}{\partial q_i} - \frac{\partial H}{\partial q_i} \frac{\partial f}{\partial p_i} \right) \\ &= \{f, H\}. \end{align} See what happens when you compute $$\{f, H\}$$ for $$f$$ and $$H$$ of the form you have given.