“Cognitive dissonance is what we feel when the self-concept — I’m smart, I’m kind, I’m convinced this belief is true — is threatened by evidence that we did something that wasn’t smart, that we did something that hurt another person, that the belief isn’t true,” said Carol Tavris, a co-author of the book “Mistakes Were Made (But Not by Me).”

She added that cognitive dissonance threatened our sense of self.

“To reduce dissonance, we have to modify the self-concept or accept the evidence,” Ms. Tavris said. “Guess which route people prefer?”

Or maybe you cope by justifying your mistake. The psychologist Leon Festinger suggested the theory of cognitive dissonance in the 1950s when he studied a small religious group that believed a flying saucer would rescue its members from an apocalypse on Dec. 20, 1954. Publishing his findings in the book “When Prophecy Fails,” he wrote that the group doubled down on its belief and said God had simply decided to spare the members, coping with their own cognitive dissonance by clinging to a justification.

“Dissonance is uncomfortable and we are motivated to reduce it,” Ms. Tavris said.

When we apologize for being wrong, we have to accept this dissonance, and that is unpleasant. On the other hand, research has shown that it can feel good to stick to our guns. One study, published in the European Journal of Social Psychology, found that people who refused to apologize after a mistake had more self-esteem and felt more in control and powerful than those who did not refuse.

“In a way, apologies give power to their recipients,” said Tyler Okimoto, an author of the study. “For example, apologizing to my wife admits my wrongdoing; but apologizing also gives her the power to choose whether she wants to alleviate my shame through forgiveness, or increase my shame by holding a grudge. Our research has found that people experience a short-term increase in their feelings of personal power and control after refusing to apologize.”