What is the function of the ribs in the respiratory system?
The ribs help in the expansion and contraction of the thoracic cavity (though that is primarily the function of the diaphragm) and also protect the lungs and heart.
When the diaphragm expands or contracts, the thoracic (chest) cavity expands or contracts, alternately pulling in air (inhalation) or expelling it (exhalation).
The ribs, which are flexible, along with the intercostal muscles, help in this process. Since expansion of the lungs is greater in the lower lobes, the floating ribs enable that process.
The ribs also form a protective cage around the heart and the lungs, protecting them from physical damage from outside.
The image below shows the respiratory system with the ribs visible only on the right side of the body.