In the Hipparchian, Ptolemaic, and Copernican systems of astronomy, the epicycle (, meaning "circle moving on another circle") was a geometric model used to explain the variations in speed and direction of the apparent motion of the Moon, Sun, and planets. In particular it explained the apparent retrograde motion of the five planets known at the time. Secondarily, it also explained changes in the apparent distances of the planets from the Earth.
It was first proposed by Apollonius of Perga at the end of the 3rd century BC. It was developed by Apollonius of Perga and Hipparchus of Rhodes, who used it extensively, during the 2nd century BC, then formalized and extensively used by Ptolemy in his 2nd century AD astronomical treatise the Almagest.
Epicyclical motion is used in the Antikythera mechanism, an ancient Greek astronomical device, for compensating for the elliptical orbit of the Moon, moving faster at perigee and slower at apogee than circular orbits would, using four gears, two of them engaged in an eccentric way that quite closely approximates Kepler's second law.
Epicycles worked very well and were highly accurate, because, as Fourier analysis later showed, any smooth curve can be approximated to arbitrary accuracy with a sufficient number of epicycles. However, they fell out of favor with the discovery that planetary motions were largely elliptical from a heliocentric frame of reference, which led to the discovery that gravity obeying a simple inverse square law could better explain all planetary motions.
In both Hipparchian and Ptolemaic systems, the planets are assumed to move in a small circle called an epicycle, which in turn moves along a larger circle called a deferent (Ptolemy himself described the point but did not give it a name). Both circles rotate eastward and are roughly parallel to the plane of the Sun's apparent orbit under those systems (ecliptic). Despite the fact that the system is considered geocentric, neither of the circles were centered on the earth, rather each planet's motion was centered at a planet-specific point slightly away from the Earth called the eccentric.