Now drop some pasta in the pot. As it cooks, organic materials (proteins, among other things) are released into the cooking water. Some of these organics have hydrocarbon parts that don't dissolve in water, and polar parts that do dissolve. They collect on the surface of the cooking water, with the polar pieces sticking into the water and the hydrocarbon pieces pointing upwards. The tight mesh of attracting water molecules is disrupted. It becomes much easier to expand the surface into bubbles. As the water boils, foam starts to form on the surface. (Soap makes suds in a similar way.)
Drop a teaspoon of olive oil into the pot. The oil won't mix well with the water, and many tiny oil droplets are formed. The oil droplets at the surface act as bubble breakers. When a bubble of foam starts to form, it encounters an oil droplet. The part of the bubble that encountered the oil droplet has a much different surface tension than the rest of the bubble, and the stress pops the bubble before it gets very large.
A little dab of butter or vegetable oil will work just as well.
Copyright © 1997-2010 by Fred Senese
Comments & questions to fsenese@frostburg.edu
Last Revised 02/23/18.URL: http://antoine.frostburg.edu/chem/senese/101/liquids/faq/print-oil-and-defoaming.shtml