Submitted by Gloria Hughes, Pasadena, California, and answered by Lucile M. Jones, Seismologist, U.S. Geological Survey/Visiting Research Associate, Caltech.
Earthquakes occur in clusters. In any cluster, the earthquake with the largest magnitude is called the mainshock, anything before it is a foreshock, and anything after it is an aftershock. A mainshock will be redefined as a foreshock if a subsequent event has a larger magnitude. Aftershock sequences follow predictable patterns as a group, although the individual earthquakes are random and unpredictable.
Aftershocks usually occur geographically near the mainshock. The stress on the mainshock's fault changes drastically during the mainshock and that fault produces most of the aftershocks. Sometimes the change in stress caused by the mainshock is great enough to trigger aftershocks on other, nearby faults, and for a very large mainshock sometimes even farther away. As a rule of thumb, we call earthquakes aftershocks if they are at a distance from the mainshock's fault no greater than the length of that fault. For example, the fault rupture length was 15 km (10 miles) in the 1994 Northridge (M6.7) earthquake, and 430 km (270 miles) in the 1906 San Francisco (M7.8) earthquake.
An earthquake large enough to cause damage will probably be followed by several felt aftershocks within the first hour. The rate of aftershocks dies off quickly: the decrease is proportional to the inverse of time since the mainshock. This means the second day has about 1/2 the number of aftershocks of the first day and the tenth has about 1/10 the number of the first day. These patterns describe only the mass behavior of aftershocks; the actual times, numbers and locations of the aftershocks are random. We call an earthquake an aftershock as long as the rate at which earthquakes occur in that region is greater than the rate before the mainshock. How long this lasts depends on the size of the mainshock (bigger earthquakes have more aftershocks) and how active the region was before the mainshock (if the region was seismically quiet before the mainshock, the aftershocks continue above the previous rate for a longer time). It can be weeks or decades.
Bigger earthquakes have more and larger aftershocks. The bigger the mainshock, the bigger the largest aftershock will be, on average. The difference in magnitude between the mainshock and largest aftershock ranges from 0.1 to 3 or more, but averages 1.2 (a M5.5 aftershock to a M6.7 mainshock, for example). There are more small aftershocks than large ones. Aftershocks of all magnitudes die off at the same rate, but because the large aftershocks are already less frequent, the decay can be noticed more quickly. We have large aftershocks months or even years after the mainshock.