The easiest way to understand density and why objects float in water is to walk in the footsteps of a great mathematician.
In the third century BC King Hieron II of Syracuse had a problem. A goldsmith had made a beautiful new crown that was shaped like a wreath of laurels. Hieron, being a suspicious fellow, wanted to make sure that it was made of solid gold rather than a cheaper mix of gold and silver. He could not tell by appearance alone so he asked our mathematician for help.
Archimedes of Syracuse quickly realised that he should measure the density of the crown. Each solid material has a unique density. Once he had determined this he could compare the result with the density of gold and the gold/silver mix and inform the king.
The experiment would not be easy. Density was a number that linked weight and volume. First he could weight the crown which was routine. To calculate the volume was more problematic. How could he calculate the volume for such a complex shape. Previous investigations had only involved regular shaped solids that he could measure; then calculate their volumes using standard formulas.
According to legend Archimedes pondered the problem in the public bath house. Noting that the water level in the bath rose as he immersed himself he jumped from the bath excitedly and run naked through the streets shouting “Eureka, I have found it”.
Archimedes realised that water was an incompressible fluid. The volume of water displaced by an object immersed in water was equal to the volume of that object. He could measure how much water was displaced when the crown was immersed. This would provide the volume figure that he needed for the density calculation. Although Archimedes had solved the problem in principle, the crown was a small object. His measurements of the water displacement would have to be very accurate to distinguish between the density of gold and gold/silver.
While experimenting Archimedes probably made his next breakthrough for which he will be remembered for all time. He found Archimedes principle that “a body immersed in a fluid experiences a buoyant force equal to the weight of the fluid it displaces.”
This is called buoyancy.
This gave Archimedes a neat way to solve the problem of the golden crown. He made weight of pure gold that was exactly equal in weight to that of the laurel crown. Then he mounted both on a lever balance which he carefully immersed into a bucket of water. By his reasoning the crown would displace an amount of water equal to its volume. If the crown was less dense than pure gold it would have a larger volume. This would cause it to displace more water than the pure gold. The water would exert a greater upthrust compared to the pure gold. Archimedes now had a sensitive test. If the goldsmith had shortchanged the king the scales would turn towards the pure gold.
Once Archimedes principles was appreciated it became easy to understand why some objects could float on water and some could not. For an object to float on water the weight of the fluid displaced has to be equal or less than the weight of the object itself. This requires an object whose density is less than that of water. Although most solids have a density greater than water they can be made to float if they are made into hollow objects. Although it would be more than two millenia before iron ships were built, Archimedes would have appreciated that they could be made to float provided that their voids were filled with air so that the overall density was less than that of water. He would have also known that if the hull was breached, water would enter the air pockets and lead these ships to sink very quickly. The Titanic sank because these air pockets filled with water and the ship rapidly lost buoyancy.