Memory is our past and future. To know who you are as a person, you need to have some idea of who you have been. And, for better or worse, your remembered life story is a pretty good guide to what you will do tomorrow. "Our memory is our coherence," wrote the surrealist Spanish-born film-maker, Luis Buñuel, "our reason, our feeling, even our action." Lose your memory and you lose a basic connection with who you are.
It's no surprise, then, that there is fascination with this quintessentially human ability. When I cast back to an event from my past – let's say the first time I ever swam backstroke unaided in the sea – I don't just conjure up dates and times and places (what psychologists call "semantic memory"). I do much more than that. I am somehow able to reconstruct the moment in some of its sensory detail, and relive it, as it were, from the inside. I am back there, amid the sights and sounds and seaside smells. I become a time traveller who can return to the present as soon as the demands of "now" intervene.
This is quite a trick, psychologically speaking, and it has made cognitive scientists determined to find out how it is done. The sort of memory I have described is known as "autobiographical memory", because it is about the narrative we make from the happenings of our own lives. It is distinguished from semantic memory, which is memory for facts, and other kinds of implicit long-term memory, such as your memory for complex actions such as riding a bike or playing a saxophone.
When you ask people about their memories, they often talk as though they were material possessions, enduring representations of the past to be carefully guarded and deeply cherished. But this view of memory is quite wrong. Memories are not filed away in the brain like so many video cassettes, to be slotted in and played when it's time to recall the past. Sci-fi and fantasy fictions might try to persuade us otherwise, but memories are not discrete entities that can be taken out of one person's head, Dumbledore-style, and distilled for someone else's viewing. They are mental reconstructions, nifty multimedia collages of how things were, that are shaped by how things are now. Autobiographical memories are stitched together as and when they are needed from information stored in many different neural systems. That makes them curiously susceptible to distortion, and often not nearly as reliable as we would like.
We know this from many different sources of evidence. Psychologists have conducted studies on eyewitness testimony, for example, showing how easy it is to change someone's memories by asking misleading questions. If the experimental conditions are set up correctly, it turns out to be rather simple to give people memories for events that never actually happened. These recollections can often be very vivid, as in the case of a study by Kim Wade at the University of Warwick. She colluded with the parents of her student participants to get photos from the undergraduates' childhoods, and to ascertain whether certain events, such as a ride in a hot-air balloon, had ever happened. She then doctored some of the images to show the participant's childhood face in one of these never-experienced contexts, such as the basket of a hot-air balloon in flight. Two weeks after they were shown the pictures, about half of the participants "remembered" the childhood balloon ride, producing some strikingly vivid descriptions, and many showed surprise when they heard that the event had never occurred. In the realms of memory, the fact that it is vivid doesn't guarantee that it really happened.
Even highly emotional memories are susceptible to distortion. The term "flashbulb memory" describes those exceptionally vivid memories of momentous events that seem burned in by the fierce emotions they invoke. In the aftermath of the terrorist attacks of 9/11, a consortium of researchers mobilised to gather people's stories about how they heard the news. When followed up three years later, almost half of the testimonies had changed in at least one key detail. For example, people would remember hearing the news from the TV, when actually they initially told the researchers that they had heard it through word of mouth.
What accounts for this unreliability? One factor must be that remembering is always re-remembering. If I think back to how I heard the awful news about 9/11 (climbing out of a swimming pool in Spain), I know that I am not remembering the event so much as my last act of remembering it. Like a game of Chinese whispers, any small error is likely to be propagated along the chain of remembering. The sensory impressions that I took from the event are likely to be stored quite accurately. It is the assembly – the resulting edit – that might not bear much resemblance to how things actually were.
When we look at how memories are constructed by the brain, the unreliability of memory makes perfect sense. In storyboarding an autobiographical memory, the brain combines fragments of sensory memory with a more abstract knowledge about events, and reassembles them according to the demands of the present. The memory researcher Martin Conway has described how two forces go head to head in remembering. The force of correspondence tries to keep memory true to what actually happened, while the force of coherence ensures that the emerging story fits in with the needs of the self, which often involves portraying the ego in the best possible light.
One of the most interesting writers on memory, Virginia Woolf, shows this process in action. In her autobiographical essay, A Sketch of the Past, she tells us that one of her earliest memories is of the pattern of flowers on her mother's dress, seen close-up as she rested on her lap during a train journey to St Ives. She initially links the memory to the outward journey to Cornwall, noting that it is convenient to do so because it points to what was actually her earliest memory: lying in bed in her St Ives nursery listening to the sound of the sea. But Woolf also acknowledges an inconvenient fact. The quality of the light in the carriage suggests that it is evening, making it more likely that the event happened on the journey back from St Ives to London. The force of correspondence makes her want to stick to the facts; the force of coherence wants to tell a good story.
How many more of our memories are a story to suit the self? There can be no doubt that our current emotions and beliefs shape the memories that we create. It is hard to remember the political beliefs of our pasts, for example, when so much has changed in the world and in ourselves. How many of us can accurately recall the euphoria at Tony Blair's election in 1997? When our present-day emotions change, so do our memories. Julian Barnes describes this beautifully in his Booker-winning The Sense of an Ending, when a shift in his protagonist Tony's feelings towards his former lover's parents unlocks new memories of their relationship. "But what if, even at a late stage, your emotions relating to those long-ago events and people change? … I don't know if there's a scientific explanation for this … All I can say is that it happened, and that it astonished me."
Of all the memories we cherish, those from childhood are possibly the most special. Few of us will have reliable memories from before three or four years of age, and recollections from before that time need to be treated with scepticism. When you think about the special cognitive tricks involved in autobiographical memory, it's perhaps no surprise that it takes a while for children to start doing it right. Many factors seem to be critical in children's emergence from childhood amnesia, including language and narrative abilities. When we are able to encode our experience in words, it becomes much easier to put it together into a memory. Intriguingly, though, the boundary of childhood amnesia shifts as you get closer to it. As a couple of recent studies have shown, if you ask children about what they remember from infancy, they remember quite a bit further back than they are likely to do as adults.
There are implications to the unreliability of childhood memories. A recent report commissioned by the British Psychological Society warned professionals working in the legal system not to accept early memories (dating from before the age of three) without corroborating evidence. One particular difficulty with early memories is their susceptibility to contamination by visual images, such as photographs and video. I'm sure that several of my childhood memories are actually memories of seeing myself in photos. When we look back into the past, we are always doing so through a prism of intervening selves. That makes it all the more important for psychologists studying memory to look for confirming evidence when asking people to recall their pasts.
And yet these untrustworthy memories are among the most cherished we have. Memories of childhood are often made out to have a particular kind of authenticity; we think they must be pure because we were cognitively so simple back then. We don't associate the slipperiness of memory with the guilelessness of youth. When you read descriptions of people's very early memories, you see that they often function as myths of creation. Your first memory is special because it represents the point when you started being who you are. In Woolf's case, that moment in her bed in the St Ives nursery was the moment she became a conscious being. "If life has a base that it stands upon," she wrote, "if it is a bowl that one fills and fills and fills – then my bowl without a doubt stands upon this memory."
What should we do about this troublesome mental function? For one thing, I don't think we should stop valuing it. Memory can lead us astray, but then it is a machine with many moving parts, and consequently many things that can go awry. Perhaps even that is the wrong way of looking at it. The great pioneer of memory research, Daniel Schacter, has argued that, even when it is failing, memory is doing exactly the thing it is supposed to do. And that purpose is as much about looking into the future as it is about looking into the past. There is only a limited evolutionary advantage in being able to reminisce about what happened to you, but there is a huge payoff in being able to use that information to work out what is going to happen next. Similar neural systems seem to underpin past-related and future-related thinking. Memory is endlessly creative, and at one level it functions just as imagination does.
That's how I think we should value memory: as a means for endlessly rewriting the self. It's important not to push the analogy with storytelling too far, but it's a valuable one. Writing about her novel, Wolf Hall, Hilary Mantel has explained how she brought the protagonist Thomas Cromwell alive for the reader by giving him vivid memories. When writers create imaginary memories for their characters, they do a similar kind of thing to what we all do when we make a memory. They weave together bits of their own personal experience, emotions and sensory impressions and the minutiae of specific contexts, and tailor them into a story by hanging them on to a framework of historical fact. They do all that while making them fit the needs of the narrative, serving the story as much as they serve truth.
To emphasise its narrative nature is not to undermine memory's value. It is simply to be realistic about this everyday psychological miracle. If we can be more honest about memory's quirks, we can get along with it better. When I think back to my first attempt at solo swimming, it doesn't bother me that I have probably got some of the details wrong. It might be a fiction, but it's my fiction, and I treasure it. Memory is like that. It makes storytellers of us all.
• Charles Fernyhough is a writer and psychologist. His book on autobiographical memory, Pieces of Light: How we Imagine the Past and Remember the Future, is published by Profile Books in July. You can pre-order it here. He is the author of The Baby in the Mirror (Granta), a reader in psychology at Durham University and a faculty member of the School of Life. You can follow him on Twitter at @cfernyhough