Forgetting why you've walked into a room is partly caused by how your brain perceives doorways.
Researchers from Notre Dame conducted an experiment and discovered that doorways might play into how our brain stores memories. They separated people into two groups, traveling the same distance. One group passed through a doorway, the other didn't.
The ones that had to walk past a doorway were three times more likely to forget their task. The researchers think this is because doorways are "event boundaries," and that decisions made in one room are remembered and stored "in that room," and it's more likely to forget them once you're not in it. So now you know, if you want to remember everything, get a house that's one big giant room (results may vary)
