We all know our memories get worse as time goes on – your recollection of what you did yesterday is probably a lot better than for the same day three years ago.

And yet we often have moments where old and seemingly forgotten memories pop back into mind. Perhaps you have visited your childhood home, walked into your old bedroom, and been hit with a wave of nostalgia. What triggers this rush of memories, and how can you suddenly remember things you may not have thought about for decades?

Researchers are realising that the context in which memories are created is crucially important in remembering them later. This idea is known as “contextual-binding theory”, and it boils down to three components: context learning, context change, and memory search.

Read more: Studying for exams? Here's how to make your memory work for you

Let’s start with learning. It is well established that learning in the brain happens by a process of association. If A and B occur together, they become associated. Contextual-binding theory goes a step further: A and B are associated not just with one other, but also with the context in which they occurred.

What is context? It’s not just your physical location – it’s a mental state that also comprises the thoughts, emotions, and other mental activity you’re experiencing at a given moment. Even as you read this page, changes in your thoughts and mental activity are causing your mental context to change.

As a consequence, each memory is associated with different states of context. However, some context states will be similar to each other – perhaps because they share the same location, or mood, or have some other factor in common.

This similarity between contexts is important when it comes to retrieving memories. Your brain’s memory search process is rather like a Google search, in that you’re more likely to find what you’re looking for if your search terms closely match the source content. During memory search, your current mental context is your set of search terms. In any given situation, your brain is rapidly rifling through your memories for ones that most closely resemble your current state of context.

Simple but deep

These mechanisms are simple, but the implications are profound. According to the theory, you’re most likely to remember memories from contexts that are similar to the context you’re in now. Because your mental context is always changing, your mental context will be most similar to recently experienced memories. This explains why it’s harder to remember older events.

But, of course, older memories aren’t permanently forgotten. If you can change your context to resemble those from seemingly long-forgotten memories, you should be able to remember them. This is why those old memories come flooding back when you step into your childhood bedroom or walk past your old school.

Giedre Vaitekuna/Shutterstock

Context-dependent memory was confirmed by an ingenious 1975 experiment in which divers memorised lists of words and were then tested both on land and underwater. On land, their recall was best for the words they had learned on land, whereas underwater they were better at remembering the word lists they learned underwater.

This phenomenon isn’t limited to physical locations. You may have noticed that when you’re sad about something, you tend to remember other sad events from your life. This is because your mood and emotions also comprise your mental context. Experiments have confirmed that memory is enhanced when your current mood matches the mood in which you learned the information.

More than a century’s worth of studies have confirmed we are also better at remembering things if we experience them at different times, rather than repeatedly in quick session. This is one of the main reasons why, when preparing for exams, a regular study routine is more effective than cramming.

According to the theory, rapidly repeated material is associated with a single state of context, whereas material repeated across different times and events is associated with several different states of context. This pays off later, when you’re sitting in the exam hall desperately trying to recall the chemical formula for potassium permanganate, because your current state of context will be more likely to match one of the many states of context in which you so diligently did your chemistry revision.

Read more: How memories are formed and retrieved by the brain revealed in a new study

Context in the brain

Contextual-binding theory can potentially explain a host of other phenomena, such as the effects of brain damage on memory. People with damage to a region in the centre of the brain called the hippocampus are often unable to form new memories. We suspect this is where context-binding actually occurs, especially given that the hippocampus receives inputs from virtually all other brain regions, enabling associations between different sights, smells, physical sensations, and emotions.

A competing theory, known as systems consolidation theory, instead proposes that memories are initially stored in the hippocampus but are gradually transferred and strengthened in other brain regions over time.

This theory is supported by the fact that memory for new material is better when you rest after learning. Time spent resting may give the brain a chance to consolidate new memories.

Fizkes/Shutterstock

However, contextual-binding theory can also potentially explain this benefit. Resting immediately after learning, as opposed to carrying on shovelling facts into your brain, means fewer memories share the same context, making them easier to distinguish when you revisit that context later.

This also explains why rest is also beneficial before learning, as well as after. And it underpins the tried and tested advice for hardworking students everywhere: don’t forget to get lots of sleep!