system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5 how do noise canceling earphones work

How does it work and how are they able to cancel out noise better than regular headphones?
gpt
To elaborate on clyde's answer for active noise cancelling:

Sound waves can interfere with each other, just like any other wave. When one sound wave is telling a material to compress, and another sound wave is telling the same part of the same material to expand, the material just does nothing. It's like adding a positive number to a negative number. The more similar in size the numbers are, the closer their sum is to zero.

Active noise cancelling headphones have microphones on the outside of them, and they record the ambient noise of your environment. This never gets stored anywhere - it goes right into a circuit which reverses the sound, like multiplying it by -1. Then that sound is played alongside your music through your headphone's speakers.

Just to be clear, the sound doesn't get reversed in terms of time - what you actually need to do is shift the sound so that when the actual ambient sound outside has a wave that's going up, the 'reverse' sound has a wave that's going down. Whatever one wave tells your eardrums to do, the other wave will try to tell your eardrums to do the oppsite thing. 

This way  all the ambient noise gets cancelled out, and your music is all that you hear.