Ever seen someone all alone, smiling away to themselves, and wondered what it was that made them laugh? Jon Ronson set out to discover the secret source of joy

I am standing at the traffic lights when the woman next to me, lost in her thoughts, suddenly bursts out laughing. Then she immediately covers her mouth with her hand and glances around, embarrassed. This gives me an idea. I phone the photographer Stephen Gill. "Let's walk around looking for people who are laughing to themselves because of something they've just thought of," I say. "When we find them, you take their photograph and I'll ask them what they were thinking about that was so funny."

"It'll be so contagious," Stephen excitedly replies, "that we'll find it impossible not to laugh ourselves!"

Stephen's loveliness never fails to surprise me. "What a wonderful idea," he adds, "for us to spend these cold, dark winter days photographing laughter! Wonderful!"

"OK, OK," I think.

"I think we'll discover that people have lovely thoughts!" Stephen continues.

"Enough," I think.

We set ourselves rules. They must be alone. There can be no external stimuli: no books, magazines, personal stereos or mobile phones. It must be their thoughts alone that are making them laugh. Ideally, they mustn't realise they've been photographed until afterwards, but if they do notice us, and their demeanour changes in any way as a result, we'll abandon the picture. If we miss the moment, we cannot ask them to laugh again for our benefit. We pledge to adhere to our rules. And, on Thursday morning, we set off.

Over the next nine hours, we spot seven people laughing to themselves. Stephen fails to photograph every single one of them. By the time he has raised his camera, their laughs have faded. I think the problem is this: if you are wandering down the street, lost in thought, laughing happily to yourself, and then, from the corner of your eye, you see a man with a notepad staring at your face, looking startled, and then elbowing a photographer in the ribs and loudly hissing, "There's one!" you're inclined to stop laughing.

"Fascinating!" says Stephen after a few hours of this. "Have you noticed how it begins with a curling of the mouth, and then the apex of the smile or the laugh never lasts longer than a second? The whole thing is usually over in three seconds. No wonder we keep missing it!"

I shoot him an angry look. Stephen does, miraculously, manage to capture the eighth laugh. It is a woman dressed all in black with a big pink scarf. She's walking through Victoria. We rush over and explain why we took her picture.

"So," I ask her, "what were you thinking about that was making you laugh?"

"No," she replies, without slowing her pace.

Stephen looks delighted. He says, "She was having such a private moment, she didn't want to share it with us!"

"Oh, for Christ's sake," I think.

But then, in a pedestrian precinct near Liverpool Street station, it all comes together. The young man in the dark suit with the red shirt and a poppy in his lapel laughs to himself for perhaps three seconds, but Stephen captures it, and when I ask him what was making him laugh, he is happy to tell me. He says, "A friend of mine pressed the wrong button and deleted all the pictures of his newborn baby from his computer, and his wife is very upset and angry with him."

With that, the jinx is broken. Over the following fortnight we average two a day. The woman in the stripy jacket, laughing to herself as she walks past an Evening Standard sign that reads "Ebay Scam Exposed", has a friend whose house was recently destroyed by flooding: "I'm laughing because this morning I heard that he's found himself a new place to live."

The woman in the navy skirt and black jacket, walking past Selborne House, is laughing because she's approaching Westminster City Hall: "I was thinking about a friend of mine who was the Lady Mayor of London a while ago. Her office was on the top floor. I was just looking up and thinking, gosh, what a lovely view she must have had."

"You see?" says Stephen, with unexpected harshness, after she leaves. "I told you people would have lovely thoughts."

"What?" I ask.

Stephen gives me a look that suggests my constant negativity (I have just quit smoking, which isn't helping) has been grinding him down.

It might seem at first glance that the woman in black, pushing the orange pram, is laughing at her baby and consequently oughtn't to be included, her baby being an external stimulus. But I can assure you that before Stephen took the photograph she was laughing into space, and it is just a coincidence that she looked down at the moment he pressed the button.

Her name is Pamela. She's Canadian. She's on a back road near the Old Street roundabout in east London.

"A photographer friend called Giulio, as a favour, is going to take a picture of my daughter Zoë," she says, "and I was just thinking about how lovely the picture will look."

"What will it look like?" I ask.

"We're building a set with feathers and fake snow," she says, "and she'll be dressed as an angel, with wings and a white dress."

"Christmas card?" I ask.

"Yes," she says.

"Ostentatious!" I say.

Pamela stops smiling.

"Lovely!" I say.

Pamela smiles again.

If I were to categorise the type of thoughts we captured over the fortnight, the biggest pile would consist of those who are laughing for straightforwardly good-hearted reasons, such as the people I list above. Many others tell me they're "just happy-go-lucky".

"I happen to love life. I'm famous for it," says one woman. "I'm happy-go-lucky."

"I'm just always smiling," says another. "I'm happy-go-lucky. The fact that I'm alive and well is enough to make me smile."

"If you're lucky enough to be alive and well," says a third, "you have a duty to be happy, because of all those people who are less fortunate than you. And anyway, I just love life."

I become so disheartened by the volume of people who give this as the reason for their laughter that at one point I interrupt a man telling me he "just loves life" by crossly saying, "Oh. You're one of those 'I just love life' people, are you?"

He looks confused and apologises. "Sorry," he says.

I turn on my heels and walk away without saying another word.

"That was incredibly rude of you," Stephen tells me.

The second biggest pile would comprise those who are laughing cynically about corporations and advertising. The man in the black suit walking past the Sainsbury's next to Westminster City Hall is called John Dimmer.

"I'm laughing because Sainsbury's were on TV this morning with some big profits announcement," he explains, "and this is the very Sainsbury's they were filming outside. It's like the worst Sainsbury's in the world. It's small and cramped. Don't get me wrong, the staff are great. But on the day they want to show everyone how well they're doing, they film at this terrible Sainsbury's. Anyway, that's why I was laughing."

Five minutes later, one street away, we photograph the woman in the blue hat and scarf, pulling the red shopping trolley. Her name is Caroline Deane and she, too, is laughing sardonically because of what she sees as nefarious advertising practices.

"I was laughing about an article I read in a glossy magazine this morning called Posh And Her Fantasy Man," she says. "But it wasn't about love at all. It was an advertorial for her jeans. This is someone who doesn't go near newspapers normally. She's not someone who wants to go to parties. But she's launching a new jeans line, so now she's popping up everywhere, trying to become prominent so people will buy them. So the article was called Posh And Her Fantasy Man, and I read it thinking it would be about love, but it was about her jeans."

A fortnight into our project and Stephen, growing tired of my relentless negativity, begins to moonlight. He goes off on day trips without telling me. The thing that upset him most was an incident on the South Bank, near Blackfriars Bridge, when he had a fully-laughing woman in his viewfinder, but bafflingly didn't take her picture.

"She wasn't laughing," he tried to explain to me, after I repeatedly asked him why the hell he didn't just press the button. "She was tensing her facial muscles."

"She was laughing," I said.

"I think," said Stephen, lowering his voice, "she was ... ill."

"You think she was laughing as a result of mental illness?"

There was a silence.

"Yes," said Stephen.

"She wasn't mentally ill, she was just happy," I screamed.

"I feel terrible guilt now," said Stephen.

That is why he begins to moonlight. Consequently, we will never know what the man holding the plastic coffee cup outside the amusement arcade was laughing about, nor any of the other people photographed in the markets around Whitechapel and Bethnal Green. Stephen took these photographs during his moonlighting trips and I wasn't there to ask them.

And perhaps the loveliest photograph of all is one we cannot publish. It occurs near Liverpool Street station on a particularly miserable day. A woman just throws her head back and laughs joyously, and Stephen captures the moment beautifully. When I ask her what she's thinking about, she replies, "Scooter Libby."

She's American. I'll call her Emma. Today's the day, the papers are reporting, Dick Cheney's chief of staff, Lewis "Scooter" Libby, is to be arrested for his part in disclosing the identity of the CIA agent Valerie Plame.

Emma is laughing to herself because she's no fan of the Bush administration. I compliment her on laughing about politics rather than something more solipsistic. She thanks me and says goodbye.

Half an hour later, Emma has a panic attack. She rushes frantically around Liverpool Street trying to find us. Finally she gets hold of us on the phone via the Guardian.

"You can't use my photograph!" she yells.

"Why not?" I ask.

"Because if the White House reads what I've said to you, they might punish me with an IRS [the US tax agency] audit."

There is a silence.

"Are you connected to the White House or politics?" I ask.

"No," she says, "I'm involved in the film business."

"Then you'll be fine," I say.

"I'm serious," she says. "They're vicious. I heard they audited Sean Penn as a punishment after he went on a peace mission to Iraq before the war."

"But surely," I say, "they aren't going to go to all that effort of tracking you down to punish you just because you laughed to yourself about Lewis Libby?"

"They might," she says.

"We'll give you a false name," I say.

"They'll see my photograph," she says.

"Look," I practically shout. "Even if they do have some kind of photo-recognition device, they aren't going to deploy it on you because you were briefly amused by Lewis Libby's misfortune."

But Emma has made up her mind. Over the phone, we toy with the idea of pretending she was laughing to herself about something else. She suggests she could be laughing about Prince Charles's comment - reported in that day's papers - that people will appreciate him after he's dead.

But in the end she makes me promise not to include her photograph at all.