Mechanism of breathing
The contraction of the external intercostal muscles of the rib cage causes it to move upwards. The muscles of the diaphragm then contract so that it flattens from its original domed shape. These muscle contractions result in an increased space in the lungs and a reduction in pressure of the thoracic cavity. Inhalation then occurs because the pressure in the thoracic cavity is less than the atmospheric pressure, resulting in air rushing into the lungs.
This is the opposite of inhaling and occurs by the relaxing of the external intercostal muscles and the relaxing of the diaphragm into a domed shape. As a result, there is less space in the lungs and an increase in pressure of the thoracic cavity. Exhalation occurs because there is more pressure in the thoracic cavity than the atmosphere, resulting in air rushing into the lungs.