Enzymes are proteins; as such they have a primary, secondary and tertiary structure. Each type of structure helps to hold the enzyme together so that it's substrate - the molecule it specifically binds to - can fit into the enzyme. The structures are each held in places by different types of bonding - hydrogen, ionic, hydrophilic/hydrophobic interactions and disulphide links. As an enzyme is heated beyond its optimum temperature, the hydrogen bonds holding the protein together vibrate and, with increasing temperature, will break.When an enzyme is in a non-optimum pH, the differing proportion of hydrogen ions (which cause changing pH)) will affect those bonds which contain a charge. These are the ionic and hydrogen bonds. Extreme pHs can therefore cause these bonds to break. When the bonds holding the complementary active site of an enzyme break, it cannot bind to its substrate. The enzyme is thus denatured, as no enzyme-substrate or enzyme-product complexes can form.