The rudder is used to control the yaw of the aircraft, helping it maintain its direction by controlling the side-to-side motion of the tail.