This is exactly the physics occuring. Amplitude of sound is pressure. When two signals are 180 degrees out of phase, one is "increases the pressure" while the other "decreases the pressure" of the air.
In an sound editor, the waveforms can be perfectly aligned.
In the physical world, the waveform created by the fan spreads out through space. Providing an opposite but equal sound waveform at your ears is very hard (impossible) with a single speaker but can be done with sound cancelling headphones.
>can be done with sound cancelling headphones
How/Why?
I guess its because all noise just enters through two holes? So you reduce the dimensions back to 1.
Yes.
If you have two speakers playing the same tone (with perhaps different phases), then the distance between you and each speakers will affect the phase at the point that they reach your ears. At different places in the room, the phases will either be out of alignment and cancel out, or in alignment and reinforce. Unless you can literally have both speakers at the exact same position, there's no way have their phase difference be the same across the whole room.
Imagine throwing two rocks into a pond and the way the ripples interact and overlap. It's the exact same phenomenon. If you could throw the two rocks at exactly the same place (and somehow throw a "negative" rock that causes ripples to go up instead of down), then the waves would all cancel out. But if they are in two different locations, you'll get a whole mess of different interactions at different places in the pond.
This isn't an issue with noise-cancelling headphones, because the distance between the incoming sound, the headphone speaker, and your ear is always fixed.