The toughest tasks can often seem far from completion, even after days of working on them—causing stress and anxiety to build. If you're facing a problem like this, consider washing your hands: Researchers have found that people feel more optimistic after doing so.

Kai Kaspar of the University of Osnabrück in Germany asked people to complete an “impossible task.” As expected, everyone bombed the exercise. Half of the subjects were asked to wash their hands, while the other half were not, and each group reported how they felt. While both cohorts admitted to feeling optimistic, those who washed their hands experienced more optimistism.

But all this positive thinking did not lead to more motivation. The subjects who didn’t wash performed better when they attempted the task a second time than those who did. This indicates that cleansing equals some sort of closure—those who had washed felt as if their work was complete.

Kaspar isn’t the first to examine hand washing and mood. Researchers know that when people feel guilty and wash their hands, their guilt lessens—what’s known at the Macbeth effect, named for the Shakespearian murderess who tries easing her conscience with a thorough scrubbing. Experts also found that cleanliness is next to godliness—a nice scrubbing makes people feel more moral.

"I wanted to enlarge this scope to actual cognitive performance because previous literature suggests that washing can remove traces of the past—undesirable or desirable," Kaspar told National Geographic. "Consequently, I asked whether washing can also reboot our optimism after failure and what consequences this would have on subsequent performance." If you want to try it, just make sure to wash for at least 20 seconds. A shorter rinsing doesn’t have the same impact.

But why does hand washing influence mood? A theory known as embodied cognition explains why a motor activity impacts a high order function such as emotions. This theory says that just as the brain controls the body, the body influences the brain. Leaning forward, for example, makes people think of the future, while leaning back causes people to reflect on the past. These physical movements take root in literary symbolism. The ideas attached to cleansing—washing away guilt, bolstering physical and mental health, and improving looks—work their way into how hand washing makes us feel.

Kaspar’s study appears in the journal Social Psychological and Personality Science.