Defining science fiction is a deceptively difficult endeavor. There are many possible definitions, covering a broad range of opinions and ideas. The task becomes even more difficult when the boundary between science fiction and fantasy is considered. Indeed, neither Barnes and Noble nor Amazon even attempt to separate the two categories. Nevertheless, this paper will explore the boundary between fantasy and science fiction, as well as the larger chasm between these two fields and the rest of fiction.
The difference between speculative fiction (a broader category which encompasses both science fiction and fantasy) and more mainstream works is somewhat easier to define. Speculative fiction is set in a world that has not happened. This differs from the definition of fiction itself in that fiction merely consists of events that didn't happen. Many works of fiction take place in realistic settings, that attempt to mimic the present or past, with no major changes. Indeed, one can often use one's knowledge of the world to help interpret realistic fiction.
Speculative fiction changes the rules inherited from reality. As a result, the reader's experience will not always be applicable to what he is reading. Along with science fiction and fantasy, "What-If" stories of alternate history would fall into the speculative category, while novels set in the present day and historical novels would tend to fail this test. Of course, there are some works that bridge the gap between speculative and realistic fiction, but the vast majority of works fall neatly into one or the other.
The hard question still remains, however: What is science fiction? More precisely, what is the difference between other forms of speculative fiction and science fiction itself? And why does it call itself science fiction rather than some other name?
To solve this, we must look at science as a field. There are a few basic assumptions that science make as it attempts to understand the universe. Foremost among them is the idea that the world is understandable, that there is indeed a set of rules that guide the universe, and that these rules are understandable and fair. (At least, nature will act the same regardless of whether the protagonist is "good" or "evil". Society, of course, is not constrained by these rules.)
Science also tends to see the world as something that can be understood, given enough thought and work. This is another theme that is reflected in science fiction. This is expressed in many different ways, ranging from rebels trying to understand their place in the universe to scientists trying to to comprehend reality itself.
Some people say that science itself is at the core of science fiction, but this is not entirely true. Science fiction is speculative fiction that's influenced by the worldview promoted by science. At its core, it's not about simply having characters pull out ray-guns instead of handguns or magic wands. Instead, science fiction is about having characters react to a universe that's governed, at it's core, by science.
Isaac Asimov's fiction is a good example of how this tends to work. The universe he creates in his novels is one governed by natural laws, which affect everyone alike. In his robot stories, these include the 3 (and more) laws of robotics, while his Foundation series even defines Psychohistory, a branch of math that he postulates allows the prediction of the behavior of humans. His universe affects characters the same no matter how they behave, and much of his fiction involves characters attempting to understand, and solve, the problems that face them. His work is perhaps the canonical example of science fiction.
On the contrary, Harlan Ellison's "A Boy and His Dog" isn't really science fiction. It's speculative, but it really fails the second test given above. While the world is fair (though cruel), there's no sense of any of the problems being addressed in a scientific manner. This is an example of a work showing a possible future world, but not in a science fiction manner... it doesn't address it through the attitudes of science.
This doesn't mean that all science fiction is hard science fiction, for much of the better work places the changes in the universe in the background, and looks at the characters through science's worldview. It's this worldview that separates science fiction from the other speculative forms of fiction. Perhaps the definiton is best summed up by Serdar Yegulalp, when he gave the definition as:
A kind of fiction that could only result from a scientifically-influenced worldview.
Halfway through writing this paper, I discovered a site that mirrors my own views on the definition. Although the Yegulalp quote was from there, I arrived at a similar definition on my own.