It's commonly believed that dogs wag their tails to convey that they are happy and friendly, but this isn't exactly true.

Dogs do use their tails to communicate, though a wagging tail doesn’t always mean, "Come pet me!"

Dogs have a kind of language that's based on the position and motion of their tails. The position of a dog's tail reveals its emotional state. [20 Weird Dog and Cat Behaviors Explained by Science]

When a dog is relaxed, its tail will be in its "natural" position, according to the American Society for the Prevention of Cruelty to Animals.

This natural position differs between breeds. The tails of most dogs, for example, hang down near their hocks, or heels. But pugs have tails that curl upward, and greyhounds have tails that rest slightly between their legs.

If a dog is nervous or submissive, it'll hold its tail lower than its natural position, and will tuck its tail under its body if it's scared. On the opposite end of the spectrum, a tail held higher than normal may indicate the dog is aroused by something, while a vertical tail indicates aggression.

A tail held straight out means the dog is curious about something.

Tail wagging reflects a dog's excitement, with more vigorous wagging relating to greater excitement.

In 2007, researchers discovered that the way a dog wags its tail also gives clues about what it's feeling.

Specifically, a tail wagging to the right indicates positive emotions, and a tail wagging to the left indicates negative emotions.

This phenomenon has to do with the fact that the brain's left hemisphere controls the right side of the body, and vice versa. Research on the approach-avoidance behavior of other animals has shown that the left hemisphere is associated with positive-approach feelings, and the right hemisphere is associated with negative-avoidance feelings.

Interestingly, a 2013 study found that dogs understand the asymmetric tail wagging of other dogs — a right-wagging tail relaxes other canines, while a left-wagging tail makes them stressed.

Originally published on Live Science.