system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How do noise cancelling headphones work?

Been using them on plane trips recently and impressed by how much sound they cut out - how does it work?
gpt
So as you know, sound is just energy causing vibrations in the air at a specific frequency. That frequency can be expressed as a wave with peaks and valleys. These waves will interfere with each other in a few ways put for our purposes there are two ways, constructive and destructive interference. Constructive interference is when the peak of one wave meets another peak, thus the energy adds together and makes the energy grow. Destructive interference is when the peak of one wave meets the valley of the other and the energy cancels out.

Noise cancelling headphones work on destructive interference. They use a tiny microphone on the outside of the headphones in order to detect outside sound. They usually focus on deep bass sounds as they have the best chance of penetrating the headphones. Then they play a sound at the frequency of that bass into the headphones which then cancels out the energy, thus silencing the bass and the noise produced to cancel the bass.