The broad genre of mystery writing has a number of subgenres that have unique and independent features. All mystery genres share in the very least the fundamental partial understanding of what is happening in the story, such that the complete tale must be discovered over the course of the book. Some mystery genres can be divided by the type of problem, others by the setting, and still others by the people who solve the problem. There are also certain subgenres that work by combining the mystery genre with another genre, such as romance. Occasionally there are books that defy genre, but once they become popularized and oft-repeated plots, those once genre-less books become their own genres as well.
One of the best ways to categorize mystery genres is by the type of detective who solves the case. Private investigator novels, for example, are a popular mystery subgenre, as are amateur investigator novels. Some people go so far as to specify the gender of the person who solves the crime as an aspect of genre. In some ways, these categories naturally imply settings, but in series of novels the crime solver typically travels around in order to provide new challenges.
The time and place where the mystery happens can also be thought of as definitive of a subgenre. For example, historical mystery novels are one of the more popular mystery genres. Cozy mysteries, which are a very well-defined type of novel, are defined both by their female protagonist and their small-town setting. Mystery stories that take place in the distant future often take the form of science fiction mysteries, though the science fiction elements of the story often overshadow the mystery elements when defining the book's genre.
While not all mystery stories involve a crime in the sense that the problem was against the law, most do involve a problem of sorts that is addressed like a crime. Murder mysteries and caper stories, for example, are both commonly thought of as genres. In some cases, the crime itself may not be against the law, as is the case in many children's mysteries involving child-level crimes. A borrowed toy or a lost dog can be the crime in a children's mystery, but child detectives in novels just as frequently solve major crimes that stump local law officials.
Finally, many mystery genres are divided up in terms of the style in which the story is told. Hard-boiled detective novels, commonly thought of as noir stories, are told in a very different way than historical romance mysteries. Different cultures also have different conventions for mystery novels, with English and Japanese mystery genres being somewhat different. In many cases, a mystery story crosses many genres, and new terms must be invented in order to cope with tales that defy genre.