$$\frac{dE}{dx} = 0$$$$\frac{\mathrm dE}{\mathrm dx} = 0$$
$$\frac{d^2E}{dx^2} > 0$$$$\frac{\mathrm d^2E}{\mathrm dx^2} \gt 0$$
The deeper valley to the right is the global minimum (at least as far as we can tell). It has the same mathematical properties, but the magnitude of the energy is lower -– the valley is deeper.
To apply this concept to chemical systems, we have to change the potential energy that we use to describe the system. Gravitational potential energy is too weak to play much of a role at the molecular level. For large systems of reacting molecules, we instead look at one of several thermodynamic potential energies. The one we choose depends on which state variables are constant. For macroscopic chemical reactions, there is usually a constant number of particles, constant temperature, and either constant pressure or volume (NPT or NVT), and so we use the Gibbs Free Energy (G$G$ for NPT systems) or the Helmholtz Free Energy (A$A$ for NVT systems).
If we can describe the thermodynamic potential energy of a system in different states, we can figure out whether a transition between two states is thermodynamically favorable -– we can calculate whether the potential energy would increase, decrease, or stay the same.
In your example using methane gas, we can look at Gibbs free energy for the reactants and products and decide that the products are more thermodynamically stable than the reactants, and therefore methane gas in the presence of oxygen at 1 atm atm and 298 K K is thermodynamically unstable.