Hamiltonian systems. Hamiltonian systems for a class of ordinary differential equations (ODE) in the phase space of a physical system viewed as a point in an Euclidean space. More precisely, let $q(t)\in\mathbb{R}^n$ be the position of the system at time $t$, and let $p(t)\in\mathbb{R}^n$ be its impulsion or momentum (mass $\times$ velocity). The Hamilton ODE reads, using the dot for the time derivative,
$\begin{cases} \dot{q}(t) &= \nabla_p H(t,q(t),p(t))\\ \dot{p}(t) &= -\nabla_q H(t,q(t),p(t)) \end{cases}$ where $H:\mathbb{R}^{2n+1}\to\mathbb{R}$ is the Hamiltonian of the system. Equivalently, with $x(t):=\begin{pmatrix}q(t)\\p(t)\end{pmatrix}$,
$\dot{x}(t)=\Omega\nabla H(t,x(t)) \quad\text{where}\quad \Omega:=\begin{pmatrix} 0 & \mathrm{id}\\-\mathrm{id}&0\end{pmatrix}.$ If the Hamiltonian does not depend on time : $H(t,q,p)=H(q,p)$, then
$\langle\dot{x}(t),\nabla H(x(t))\rangle =\langle\Omega\nabla H(x(t)),\nabla H(x(t))\rangle =0,$ because $\Omega$ is skew-symmetric. Geometrically, this means that $\dot{x}(t)\perp\nabla H(x(t))$, the trajectory $t\mapsto x(t)$ remains in a level set of $H$, and $t\mapsto H(x(t))$ is constant. This is a conservation law.

By the way, for a square matrix $A$, we have $\langle A v,v\rangle=0$ for all $v$ if and only if $A$ is skew-symmetric : $A=-A^\top$. Indeed, this is sufficient since $\langle A v,v\rangle=\langle A^\top v,v\rangle=-\langle A v,v\rangle$, and necessary since $v=e_i+e_j$ gives $A_{ij}+2A_{ii}+A_{ji}=0$, thus $A_{ii}=0$, $A_{ij}=-A_{ji}$.

An important example of Hamiltonian in classical mechanics is given by
$H(t,q,p) =H(q,p) =\sum_{k=1}^n\frac{p_k^2}{2m_k}+V(q_1,\ldots,q_n),$ which is a sum of kinetic energy and potential energy. The conservation law above is nothing else but the conservation of this total energy, while the ODE above translates into the Newton fundamental relation of dynamics
\begin{align*} \dot{q}_k(t)&=v_k(t)=\frac{p_k(t)}{m_k}\text{ (tautology)}\\ m_k\ddot{q}_k(t)&=m_k\dot{v}_k(t)=\dot{p}_k(t)=-\partial_kV(q_1(t),\ldots,q_k(t)).\end{align*} Actually this example explains the choice of $\Omega$ above, with $\mathrm{Id}$ to implement the tautology. This is the usual trick that transforms a second order scalar equation into a first order vector equation, used $n$ times, providing at the end an ODE in $\mathbb{R}^{2n}$.

Notation. The notation $q$ and $p$ is strange : neither impulsion nor momentum begin with $p$, and position does not contain $q$, which comes after $p$. There are some half-convincing explanations here and there. It seems, according to the collected works provided by the Gallica service of the Bibliothèque Nationale de France, that Joseph-Louis Lagrange (1736 — 1813) never used this notation $q$ and $p$. The collected works of William Rowan Hamilton (1805 — 1865) available electronically on libgen do not contain the notation $q$ and $p$ neither. For sure the letters $q$ and $p$ are used in a commentary note by the Editor M.J. Bertrand, about Lagrange works, which is posterior to Hamilton works. It seems that Bertrand used these letters arbitrarily, and that his commentaries were read by a large number of people, while the works of Hamilton remained almost inaccessible for decades, before the publication of the collected works of Hamilton. Still regarding notation, some people believe that the letter $H$ is used in honor of Christian Huygens (1629 — 1695) (how to pronounce this name) and not Hamilton.

Liouville theorem. It turns out that Hamiltonian systems satisfy to a more general conservation law, that remains valid when $H$ depends on time, known as the Liouville theorem, discovered by Joseph Liouville (1809 — 1882) : the flow $\varphi_{t_0}(t,\cdot)$ of the Hamiltonian ODE conserves the volume in the phase space, in the sense that the determinant of the Jacobian of $\varphi_{t_0}(t,\cdot)$ is constant and equal to $1$. Recall that the flow of an ODE $\dot{x}(t)=f(t,x(t))$ is the function $\varphi_{t_0}(t,x)$ that gives the value at time $t$ of the solution of the ODE that starts from $x$ at time $t_0$, in other words $\varphi_{t_0}(t_0,x)=x$ and $\partial_t\varphi_{t_0}(t,x)=f(t,\varphi_{t_0}(t,x))$. Let us examine this fact in the special case
$H(t,x)=\langle x,M(t)x\rangle \quad\text{with}\quad M=M^\top\in\mathcal{C}(I,\mathbb{R}^{2n}),$ where $H$ is a quadratic form of $x$. In this case
$\nabla_xH(t,x)=2M(t)x$ and the Hamiltonian ODE is nothing else but the (non-autonomous homogeneous) linear ODE
$\dot{x}(t)=2\Omega M(t)x(t).$ In this case $\varphi_{t_0}(t,x)=R(t,t_0)x$ (Duhamel formula), thus $\mathrm{Jac}\varphi_{t_0}(t,\cdot)=R(t,t_0)$, and the result comes from the conservation of the determinant of the resolvent of linear ODEs
$\det(R(t,t_0))=\exp\Bigr(\int_{t_0}^t\mathrm{trace}(2\Omega M(s))\mathrm{d}s\Bigr)$ since the skew-symmetry $\Omega^\top=-\Omega$ gives
$\mathrm{trace}[\Omega M] =\mathrm{trace}[(\Omega M)^\top] =-\mathrm{trace}[M\Omega] =0\quad\text{when M=M^\top}.$ When $H$ is not quadratic, the ODE is no longer linear, but we may linearize the flow.

Mechanics. The classical mechanics of Isaac Newton (1643 — 1727) comes with a fundamental relation of dynamics which states that the mass times the acceleration (or equivalently the time derivative of momentum) is equal to the sum of forces, a principle of inertia and a principle of action-reaction for forces. This leads to the conservation laws of energy and momentum. It is possible to reformulate classical mechanics using only energy, without using forces. Historically, the first reformulation of classical mechanics is due to Joseph-Louis Lagrange (1736 — 1813) and involves the difference between kinetic and potential energies : the Lagrangian $L(q,\dot{q})$. Its integral along the time (the action), when minimized with respect to the position $q$ and velocity $\dot{q}$ (principle of least action), under the constraints, provides the trajectory. The minimizer of this variational formulation is characterized by the Euler-Lagrange equations. This formulation of mechanics was extended later on to relativistic mechanics. It is also at the origin of modern optimization and calculus of variations. Nowadays, the emergence of conservation laws from the principle of least action is captured by the Emmy Nœther theorem in mathematical physics (1882 — 1935). The reformulation of classical mechanics due to William Rowan Hamilton (1805 — 1865) involves the sum of the kinetic and potential energies : the Hamiltonian $H(q,p)$. This quantity is conserved. The trajectory is obtained by using the Hamilton ordinary differential equations that involve the position $q$ and the momentum $p$ (instead of the velocity $\dot{q}$). These equations involve a skew-symmetric matrix and are at the origin of symplectic geometry. This formulation of classical mechanics is well suited for quantum mechanics. The Lagrangian gives the Hamiltonian as a Legendre transform with respect to the velocity variable.

Note. This tiny post is taken from a course on topology and differential calculus, that I have the pleasure of teaching, succeeding to my former colleague Dmitry Chelkak.