How can you train your brain to build good and healthy habits? originally appeared on Quora - the knowledge sharing network where compelling questions are answered by people with unique insights.

Answer by Charles Duhigg, staff writer for the New York Times and author of Smarter Faster Better, on Quora:

The key is to remember that every habit has three components: a cue (which is like a trigger for a habit to start), a routine (which is the behavior itself) and a reward (which is why your brain learns to make this into an automatic behavior in the first place.)

The reward is really, really important.

Rewards are why our brains take even very complex behaviors and make them occur almost without us thinking about them. But rewards are also really complex and hard to discern. It's unclear, sometimes, what reward is driving a particular pattern.

Take nail biting; oftentimes, the cue for nail biting is anxiety or boredom. And then the routine is biting our nails. So what's the reward? It turns out that, often, it's that sharp, almost so-fast-you-don't-even-notice-it pain that nail biting causes. That pain occurs in the same part of the brain where anxiety or boredom often resides, and the pain sensation overwhelms and crowds out the tension related to anxiety or boredom.

In other words, our brain prefers pain to tension, and so nail biting becomes a habit.

You probably wouldn't have guessed that a pain sensation is the reward that compels a nail biting habit, right?

That's what I mean when I say that rewards are important, but sometimes hard to discern. For more on how to think about this (and how to identify the rewards that are necessary to train your brain to build good and healthy habits), let me recommend this: A Guide to Changing Habits - Charles Duhigg.

This question originally appeared on Quora - the knowledge sharing network where compelling questions are answered by people with unique insights. You can follow Quora on Twitter, Facebook, and Google+. More questions: