How does a noise-cancelling headphone work?

A noise-canceling headphone can actively monitor the background noise and generate an opposite waveform to negate the noise and prevent it from reaching your ear. Sound is transmitted as waveforms in the air and the measurement of the sound is the amplitude. A noise-canceling device can generate an inverted waveform to match a noise peak with a trough and vice versa. When combining the noise waveform and the inverted waveform their amplitude becomes zero and the noise feels like it is canceled.