system
Given the following post, respond as if you're commenting on Reddit:
human
Why does shaking a carbonated beverage cause it to violently erupt after opening it?
gpt
This is more of a physics question.

The beverage is a solution of carbon dioxide, various flavorings, and some kind of sweetener. The beverage is pressurized, which is important because the solubility of gases increases with increasing pressure. This means that the beverage has more gas dissolved in it in the closed state than it could hold if it were at atmospheric pressure in the open state. However, gas coming out of solution is not instant and takes time (which is why carbonated beverages take many minutes to become flat). The main way to speed up the dissolution of the dissolved gasses is to introduce nucleation sites or bubble formation. Both of these are somewhat related. Starting a bubble is hard. For a bubble to form, it has to break the surface tension/adhesive forces of the liquid. Growing a bubble is a lot easier than starting one since the surface tension component is proportioal to the bubbles surface area where as the bubble grows with volume (and volume is proportioal to the amount of gas within the bubble). This means that as more gas goes into the bubble, it's easier for the next one to go in.

When the beverage is shaken, tiny bubbles form (that are for the most part formed irrespective of dissolved gasses). Since you've introduced a bunch of bubbles, when the beverage is opened, all the dissolved gas has an easy "exit point" and can go into all the existing bubbles. So all those tiny bubbles in the closed beverage rapidly expand when the beverage is opened, leading to the violent eruption.