I was wondering that like whenever I boil milk I just have to keep standing in front of it to make sure that I don't waste any milk but then I was wondering like Why does it even overflow ? In case of water it doesn't happen. What makes it to behave like this ?
Milk contains surfactants (primarily lipids), which allow stable bubbles to form. In intense boiling, these bubbles can become mixed with liquid, supporting the liquid above them and forming what I'll call for want of a better term a "wet froth." Imagine a bunch of sponges made out of liquid. They take up more space than they would if you compressed them down and forced out the air. The inclusion of the water vapor in the bubbles lowers the density of the mixture, causing it to expand and overflow the pot.
The state is only stable because the added energy keeps creating new bubbles to replace any that have popped and keeps forcing liquid upward, while it would normally fall.
Water does not experience this mostly because its bubbles are far less stable. In fact, pure water does not form bubbles at all. The bubbles formed in water is typically due to impurities. If you were to add soap to a boiling pot of water, you would see the exact same effect, if not worse.
1$\begingroup$ This is not a third of the problem. $\endgroup$– KarlSep 14, 2015 at 21:44
Milk proteins denaturate in the heat and form a stable film on the surface of water bubbles. Bubbles on the surface burst in the beginning, and so the film becomes more and more stable there, stablilising the "foam" below.
The correct analogy is a pot of boiling water with pasta: As long as you leave the lid on, it will keep boiling over.
The reason is because milk is an emulsion of fat and water. When you boil milk, the fat separates to the top and forms a layer on top. The water below boils and vaporizes to form steam, but is trapped by the layer of fat above. It pushes the layer up, causing milk to rise.