The lungs can be expanded and contracted in two ways: (1) by downward and upward movement of the diaphragm to lengthen or shorten the chest cavity, and (2) by elevation and depression of the ribs to increase and decrease the anteroposterior diameter of the chest cavity. Figure 1 shows these two methods.

Fig1. Contraction and expansion of the thoracic cage during expiration and inspiration, demonstrating diaphragmatic contraction, function of the intercostal muscles, and elevation and depression of the rib cage. AP, anteroposterior.
Normal quiet breathing is accomplished almost entirely by the first method, that is, by movement of the diaphragm. During inspiration, contraction of the diaphragm pulls the lower surfaces of the lungs downward. Then, during expiration, the diaphragm simply relaxes, and the elastic recoil of the lungs, chest wall, and abdominal structures compresses the lungs and expels the air. During heavy breathing, however, the elastic forces are not powerful enough to cause the necessary rapid expiration, so extra force is achieved mainly by contraction of the abdominal muscles, which pushes the abdominal con tents upward against the bottom of the diaphragm, thereby compressing the lungs.
The second method for expanding the lungs is to raise the rib cage. Raising the rib cage expands the lungs because, in the natural resting position, the ribs slant downward, as shown on the left side of Figure 1, thus allowing the sternum to fall backward toward the vertebral column. When the rib cage is elevated, however, the ribs project almost directly forward, so the sternum also moves forward, away from the spine, making the anteroposterior thickness of the chest about 20 percent greater during maximum inspiration than during expiration. Therefore, all the muscles that elevate the chest cage are classified as muscles of inspiration, and the muscles that depress the chest cage are classified as muscles of expiration.
The most important muscles that raise the rib cage are the external intercostals, but others that help are the (1) sternocleidomastoid muscles, which lift upward on the sternum; (2) anterior serrati, which lift many of the ribs; and (3) scaleni, which lift the first two ribs.
The muscles that pull the rib cage downward during expiration are mainly (1) the abdominal recti, which have the powerful effect of pulling downward on the lower ribs at the same time that they and other abdominal muscles also compress the abdominal contents upward against the diaphragm, and (2) the internal intercostals.
Figure 1 also shows the mechanism by which the external and internal intercostals act to cause inspiration and expiration. To the left, the ribs during expiration are angled downward, and the external intercostals are elongated forward and downward. As they contract, they pull the upper ribs forward in relation to the lower ribs, which causes leverage on the ribs to raise them upward, thereby causing inspiration. The internal intercostals function exactly in the opposite manner, functioning as expiratory muscles because they angle between the ribs in the oppo site direction and cause opposite leverage.