IF YOU have ever sat alone in a bar, depressed by how good-looking everybody else seems to be, take comfort—it may be evolution playing a trick on you. A study just published in Evolution and Human Behavior by Sarah Hill, a psychologist at the University of Texas, Austin, shows that people of both sexes reckon the sexual competition they face is stronger than it really is. She thinks that is useful: it makes people try harder to attract or keep a mate.

Dr Hill showed heterosexual men and women photographs of people. She asked them to rate both how attractive those of their own sex would be to the opposite sex, and how attractive the members of the opposite sex were. She then compared the scores for the former with the scores for the latter, seen from the other side. Men thought that the men they were shown were more attractive to women than they really were, and women thought the same of the women.

Dr Hill had predicted this outcome, thanks to error-management theory—the idea that when people (or, indeed, other animals) make errors of judgment, they tend to make the error that is least costly. The notion was first proposed by Martie Haselton and David Buss, two of Dr Hill's colleagues, to explain a puzzling quirk in male psychology.

As studies show, and many women will attest, men tend to misinterpret innocent friendliness as a sign that women are sexually interested in them. Dr Haselton and Dr Buss reasoned that men who are trying to decide if a woman is interested sexually can err in one of two ways. They can mistakenly believe that she is not interested, in which case they will not bother trying to have sex with her; or they can mistakenly believe she is interested, try, and be rejected. From an evolutionary standpoint, trying and being rejected comes at little cost, except for hurt feelings. Not trying at all, by contrast, may mean the loss of an opportunity to, among other things, spread one's DNA.

There is an opposite bias in women's errors. They tend to undervalue signs that a man is interested in a committed relationship. That, the idea goes, is because a woman who guesses wrongly that a man intends to stick around could end up raising a child alone.

On looks, however, men and women make the same error. So go on, pluck up your courage: you may think the competition is frighteningly hot, but then so does she.