Creation of the text
The vast majority of scholars specializing in the study of the Analects believe that the text was written and compiled within a century after Confucius' death in 473 BC, mainly by Confucius' first- and second-generation pupils. According to this traditional account, the work would have been written and completed sometime during the Warring States period (476 BC-221 BC). Most Analects scholars also believe that, by the early Han dynasty (206 BC-220 AD) the book was widely known and transmitted throughout China in a mostly complete form. Because no texts dated earlier than about 50 BC have been discovered, and because the Analects was not referred to by name in any existing source before the early Han dynasty, some scholars have proposed dates as late as 140 BC for the text's compilation. A larger collection of Confucius' teachings existed in the Warring States period than has been preserved directly: 75% of Confucius' sayings cited by his second-generation student, Mencius, do not exist in the received text of the Analects.
Regardless of how early the text of the Analects existed, the book only achieved its final, complete form during the Han dynasty. According to the Han dynasty scholar Liu Xiang, there were two versions of the Analects that existed at the beginning of the Han dynasty: the "Lu version" and the "Qi version". The Lu version contained twenty chapters, and the Qi version contained twenty-two chapters, including two chapters not found in the Lu version. Of the twenty chapters that both versions had in common, the Lu version had more passages. Each version had its own masters, schools, and transmitters.
In the reign of Emperor Jing of Han (r. 157-141 BC), a third version (the "Old Text" version) was discovered hidden in a wall of the home then believed to be Confucius' when the home was in the process of being destroyed by King Gong of Lu (r. 153-128 BC) in order to expand the king's palace. The new version did not contain the two extra chapters found in the Qi version, but it split one chapter found in the Lu and Qi versions in two, so it had twenty-one chapters, and the order of the chapters was different. The old text version got its name because it was written in characters not used since the earlier Warring States period (i.e. before 221 BC), when it was assumed to have been hidden. According to the Han dynasty scholar Huan Tan, the old text version had four hundred characters different from the Lu version (from which the received text of the Analects is mostly based), and it seriously differed from the Lu version in twenty-seven places. Of these twenty-seven differences, the received text only agrees with the old text version in two places.
Over a century later, the tutor of the Analects to Emperor Cheng of Han, Zhang Yu (d. 5 BC), synthesized the Lu and Qi versions by taking the Lu version as authoritative and selectively adding sections from the Qi version, and produced a composite text of the Analects known as the "Zhang Hou Lun". This text was recognized by Zhang Yu's contemporaries and by subsequent Han scholars as superior to either individual version, and is the text that is recognized as the Analects today. No complete copies of either the Lu version, the Qi version, or the old text version of the Analects exist today, though fragments of the old text version were discovered at Dunhuang.
Before the late twentieth century the oldest existing copy of the Analects known to scholars was found in the "Stone Classics of the Xinping Era", a copy of the Confucian classics written in stone in the old Eastern Han dynasty capital of Luoyang around 175 AD. Archaeologists have since discovered two handwritten copies of the Analects that were written around 50 BC, during the Western Han dynasty. They are known as the "Dingzhou Analects", and the "Pyongyang Analects", after the location of the tombs in which they were found. The Dingzhou Analects was discovered in 1973, but no transcription of its contents was published until 1997. The Pyongyang Analects was discovered in 1992. Academic access to the Pyongyang Analects has been highly restricted, and no academic study on it was published until 2009.
The Dingzhou Analects was damaged in a fire shortly after it was entombed in the Han dynasty. It was further damaged in an earthquake shortly after it was recovered, and the surviving text is just under half the size of the received text of the Analects. Of the sections that survive, the Dingzhou Analects is shorter than the received Analects, implying that the text of the Analects was still in the process of expansion when the Dingzhou Analects was entombed. There was evidence that "additions" may have been made to the manuscript after it had been completed, indicating that the writer may have become aware of at least one other version of the Analects and included "extra" material for the sake of completeness. The content of the Pyongyang Analects is similar to the Dingzhou Analects; but, because of the secrecy and isolationism of the North Korean government, only a very cursory study of it has been made available to international scholars, and its contents are not completely known outside of North Korea. Scholars do not agree about whether either the Dingzhou Analects or the Pyongyang Analects represent the Lu version, the Qi version, the old text version, or a different version that was independent of these three traditions.
Importance within Confucianism
During most of the Han period the Analects was not considered one of the principal texts of Confucianism. During the reign of Han Wudi (141-87 BC), when the Chinese government began promoting Confucian studies, only the Five Classics were considered canonical (jing) by the government. They were considered Confucian because Confucius was assumed to have partially written, edited, and/or transmitted them. The Analects, during Han Wudi's reign, was considered secondary because it was considered only a collection of Confucius' oral "commentary" (zhuan) on the Five Classics.
The political importance and popularity of Confucius and Confucianism grew throughout the Han dynasty, and by the Eastern Han the Analects was widely read by schoolchildren and anyone aspiring to literacy, and was usually read before the Five Classics themselves. During the Eastern Han the heir apparent was provided a tutor specialized solely in teaching him the Analects. The growing importance of the Analects within Confucianism was recognized during the Eastern Han when the Five Classics was expanded to the "Seven Classics": the Five Classics plus the Analects and the Classic of Filial Piety. The status of the Analects as one of the central texts of Confucianism continued to grow until the late Song dynasty (960-1279), when it was identified and promoted as one of the Four Books by Zhu Xi and generally accepted as being more insightful than the older Five Classics.
Since the Han dynasty Chinese readers have interpreted the Analects by reading scholars' commentaries on the book. There have been many commentaries on the Analects since the Han dynasty, but the two commentaries which have been most influential on Chinese readers' interpretation of the text have been the Collected Explanations of the Analects (Lunyu Jijie) by He Yan (c. 195-249) and several colleagues, and the Collected Commentaries of the Analects (Lunyu Jizhu) by Zhu Xi (1130-1200). He's work collected, selected, summarized, and rationalized the most insightful of all preceding commentaries on the Analects which had been produced by earlier Han dynasty and Wei dynasty (220-265 AD) scholars. He's personal interpretation of the Lunyu was guided by his belief that Daoism and Confucianism complimented each other, so that by studying them both in a correct manner a scholar could arrive at a single, unified truth. Arguing for the ultimate compatibility of Daoist and Confucian teachings, he argued that "Laozi [in fact] was in agreement with the Sage" (sic). The Explanations was written in 248 AD, was quickly recognized as authoritative, and remained the standard guide to interpreting the Analects for nearly 1000 years, until the early Yuan dynasty (1271-1368). It is the oldest complete commentary on the Analects that still exists.
He Yan's commentary was eventually displaced as the definitive, standard commentary by Zhu Xi's commentary. Zhu Xi's work also brought together the commentaries of earlier scholars (mostly from the Song dynasty), along with his own interpretations. Zhu's work took part in the context of a renewed interest in Confucian studies, in which Chinese scholars were interested in producing a single "correct" intellectual orthodoxy that would "save" Chinese traditions and protect them from foreign influences, and in which scholars were increasingly interested in metaphysical speculation.
In his commentary Zhu made a great effort to interpret the Analects by using theories elaborated in the other Four Books, something that He Yan had not done. Zhu's interpretation attempted to give an added coherence and unity to the message of the text, demonstrating that the individual books of the Confucian canon gave meaning to the whole, just as the whole of the canon gave meaning to its parts. In his preface, Zhu Xi stated that "the Analects and the Mencius are the most important works for students pursuing the Way... The words of the Analects are all inclusive; what they teach is nothing but the essentials of preserving the mind and cultivating [one's] nature". From his first publication of the Commentaries, Zhu continued to refine his interpretation for the last thirty years of his life. In the fourteenth century Zhu's commentary was endorsed by the Chinese government, and until 1905 it was read and memorized along with the Analects by all Chinese aspiring to literacy and employment as government officials.