  The empirical studies of city-size distribution show that Zipf's law and the
hierarchical scaling law are linked in many ways. The rank-size scaling and
hierarchical scaling seem to be two different sides of the same coin, but their
relationship has never been revealed by strict mathematical proof. In this
paper, the Zipf's distribution of cities is abstracted as a q-sequence. Based
on this sequence, a self-similar hierarchy consisting of many levels is defined
and the numbers of cities in different levels form a geometric sequence. An
exponential distribution of the average size of cities is derived from the
hierarchy. Thus we have two exponential functions, from which follows a
hierarchical scaling equation. The results can be statistically verified by
simple mathematical experiments and observational data of cities. A theoretical
foundation is then laid for the conversion from Zipf's law to the hierarchical
scaling law, and the latter can show more information about city development
than the former. Moreover, the self-similar hierarchy provides a new
perspective for studying networks of cities as complex systems. A series of
mathematical rules applied to cities such as the allometric growth law, the 2^n
principle and Pareto's law can be associated with one another by the
hierarchical organization.
