If you've ever woken up with your heart pounding and your teeth on edge after a particularly frightening or negative dream, you're far from alone. Nightmares are most common among children, according to the National Sleep Foundation, but adults experience them regularly; up to 5 percent of the adult population has a "nightmare disorder," according to the Mayo Clinic, where nightmares are so common and distressing that they start to affect everyday functioning. But virtually everybody has experienced at least one upsetting or miserable dream, particularly if they've done something to trigger it — like watching a scary movie late at night. But why do we have them? It turns out that nightmares are actually an interesting aspect of brain function, and don't just function as a way to make us sweat in our sleep.
A 2014 survey of the content of nightmares found that people didn't necessarily experience terror in their nightmares; they felt a wide range of emotions, like disgust, shame, confusion, guilt, and sadness. And at the worse end of the spectrum, there are "night terrors", which are distinguished from nightmares by their severity and physical reactions. People with night terrors, both children and adults, may scream and thrash while they're asleep, but they likely don't remember the terror the next day. Nightmares, by contrast, are confined to the dream world — but that doesn't make them any less horrible. Fortunately, ish, there are some reasons they happen that actually make some sense.