How does carrier frequency and pulse width modulation in a VFD work together to control AC motor speed?
In a VFD, the carrier frequency is the frequency of switching the power devices. To start with a simple example, consider the H bridge circuit shown below. The  four transistors can be switched sequentially to produce a crude approximation of a sine wave. There are two on/off switching cycles required to produce one cycle of the output waveform, so the switching frequency is twice the output frequency. If the output frequency changes the carrier frequency must change proportionally.



To control an induction motor, the voltage must be controlled to maintain a relatively constant ratio of voltage to frequency. To do that with pulse width modulation (PWM), one or more switching events must be added to the scheme as shown below. Adding PWM to control the voltage with this scheme makes the switching frequency six times the output frequency. The switching frequency is usually selected to be much more than six times the output frequency to reduce the harmonic content and provide a better quality effective output waveform. Various manufacturers describe their control schemes in different ways. In one way or another, the waveform required to produce the desired motor performance is calculated and the devices are switched accordingly within limits that the design has put on the switching frequency.



It is possible to use a higher number of modulated pulses at lower output frequencies in comparison to the number used at higher output frequencies. In that case, the switching frequency as a multiple of output frequency could  rise and fall as the output frequency increases rather than just rising in proportion to output frequency. There are other factors in the overall control scheme and VFD design that add further complexity to the relationship between output frequency and switching frequency.

The following diagrams shows two possible PWM designs based on a triangle carrier wave intercepting a sinusoid reverence wave. These show how a variable frequency with proportional variable voltage PWM sine wave simulation can be implemented with either a carrier frequency that is a multiple pf the sine frequency or with a constant carrier frequency.



Note that the switching rate is only the count of on/off and off/on transitions per second. The "on" duration and "off" duration can be adjusted over a wide range without changing the switching frequency.

Various aspects of the “triangulation method” pulse width modulation schemes for VFDs are described in:

J. Zubek, A. Abbondanti and C. J. Norby, "Pulsewidth Modulated Inverter Motor Drives with Improved Modulation," in IEEE Transactions on Industry Applications, vol. IA-11, no. 6, pp. 695-703, Nov. 1975.
doi: 10.1109/TIA.1975.349357

That paper cites:

K. Heintze et al., “Pulse  width modulating static inverters for the speed control of induction motors,” Siemens-Z., vol. 45 (3), pp. 154-161, 1971.

and:

A. Schonung and H. Stemmler, "Static frequency changers with subharmonic control in conjunction with reversible variable speed ac drives," Brown-Boveri Review, pp. 555-577, Aug./Sept. 1964.

The triangulation method may have been used to some extent before microprocessors were used in VFDs. In many discussions, the triangle carrier wave is used to illustrate the basic principle rather than to describe the detailed implementation. With microprocessor control, it is possible to simulate sine waves with variable voltage and frequency in many ways with a fixed or variable switching frequency. Many schemes have been described and used. It is difficult to determine which schemes are popular today.

There may be schemes that, in effect, change the both the number and width of PWM pulses for every cycle of output waveform that is produced. In most modern VFD designs, the processor constantly recalculates the required output voltage and frequency.