As you may know, the E-L equations are given by $\frac{d}{dt} \left( \frac{\partial L}{\partial v_j} \right) = \frac{\partial L}{\partial x_j},\forall j\in\{ 1,\ldots ,n \}$, where $ \begin{matrix} L:&\mathbb{R}^n&\rightarrow&\mathbb{R}\\ &(v,x,t)&\mapsto&L(v,x,t)\\ \end{matrix}$
Now, if $\left|\frac{\partial^2 L}{\partial x_i\partial x_j}\right|\neq0$ we can locally solve $y_k=\frac{\partial L}{\partial v_j} $ to yield $v_j=G_k(t,x,y)$. Then we define the hamiltonian $H=\displaystyle\sum_{j=1}^{n}y_jv_j-L$.
So far, so good, now, the book I'm reading claims that $$ \frac{\partial H}{\partial x_j}=-\frac{\partial L}{\partial x_j},\frac{\partial H}{\partial y_j}=G_k $$
From which the hamiltonian system follows. The funny thing is, I've have seen this computation many times before however now I can't figure out for the life of me, how $ \frac{\partial H}{\partial x_j}= -\frac{\partial L}{\partial x_j} $
I just get, $ \displaystyle\frac{\partial H}{\partial x_k}= \sum_{j=1}^{n}\left( \frac{\partial y_j}{\partial x_k}v_j +\frac{\partial v_j}{\partial x_k}y_j \right)-\frac{\partial L}{\partial x_j} $(*)
And I don't know how to proceed. Any idea on how to show that $ \frac{\partial y_j}{\partial x_k}v_j +\frac{\partial v_j}{\partial x_k}y_j=0 $(which as I remember was the way to go to show (*))