Yamaga Sokō had been studying the Chinese classics since the age of six, and at nine became a student of Hayashi Razan, a follower of Neo-Confucianism responsible for its development as the official doctrine of the Tokugawa shogunate. However, at the age of forty he broke away from the official doctrine and changed his concept of Confucianism, burning all of the books he had written while still under its influence. This, along with the publishing of a philosophical work entitled Seikyo Yoroku, caused him to be removed from the bureaucracy and exiled outside Edo. Soon after being exiled, he moved to the Akō Domain, befriending Asano Nagatomo and becoming an important teacher of Confucianism and military science in the region. Yamaga's influence would later be expressed in the Genroku Akō incident, as its leader, Ōishi Yoshio, had been a devoted pupil of his. Yamaga wrote a series of works dealing with "the warrior's creed" and "the way of the gentleman". In this way he described the lofty mission of the warrior class and its attendant obligations. According to William Scott Wilson in his Ideals of the Samurai, Yamaga "in his theory of Shidō, defined the warrior as an example of Confucian purity to the other classes of society, and as punisher of those who would stray from its path". Wilson wrote that Yamaga thought of the samurai as a "sort of Warrior-Sage" and focused his writings on the perfection of this "transcendent ideal", but "this direction of thinking ... was typical of the scholars of the Edo Period in its tendency toward speculation". He re-emphasized that the peaceful arts, letters, and history were essential to the intellectual discipline of the samurai. Yamaga thus symbolizes the historical transformation of the samurai class from a purely military aristocracy to one of increasing political and intellectual leadership. One of his pupils was Daidōji Yūzan, a samurai from the Daidōji family, who would become the author of an important bushidō text, Budō shoshin shu. He also drew attention to the need to study and adopt Western weapons and tactics, as introduced by the Dutch. In 1665, Yamaga publicly avowed his antipathy for Neo-Confucianism in the Essence of Confucianism and was arrested the following year at the instigation of Hoshina Masayuki, Lord of Aizu. Yamaga proclaimed his belief that the unadulterated truth could only be found in the ethical teachings of Confucius, and that subsequent developments within the Confucian tradition represented perversions of the original doctrine. Hoshina, however, saw this attack as a potential challenge to Tokugawa authority itself, and Yamaga was subsequently exiled to stay with the Asanodaimyō in the Akō domain, where his life intersects with the tale of the forty-seven rōnin, which was later retold in a classic of Japanese literature, Chūshingura. The life of his near contemporary Matsudaira Sadanobu presents a plausible context for more fully understanding and appreciating Yamaga's life. Both believed entirely in the civic and personal values of Confucianism, but both construed those precepts a little differently because of their places in Edo period society. In his own time, this conception of Confucian values was among the factors that led him to draw attention to the need to study and adopt Western weapons and tactics, as introduced by the Dutch.
Yamaga's conception restated and codified the writings of past centuries and pointed to the emperor as the focus of all loyalties. His teachings, therefore, had direct application for everyone in the existing feudal structure, and he was not calling for a change in the status of the emperor.
''Chucho Jijitsu''
An important theme running through Yamaga's life and works was a focus on the greatness of Japan, and this became one of the reasons his popularity and influence were to expand in the rising nationalistic culture of the mid-twentieth century. Living at a time when very few texts were written in Japanese and Japanese scholars devoted themselves to the study of Chinese history, literature, and philosophy, he wrote the Chucho Jijitsu to awaken Japanese scholars to the greatness of their own national history and culture. His argument is that Japan is a gift of the gods to the Japanese people, and that while many nations consider their country to be the center of the world, on the objective basis of temperate climate, only China and Japan can justify such claims, and of the two Japan is clearly superior because it is favored by the gods, as proven by the fact that only in Japan is there an unbroken Imperial line descended from the gods themselves. The tone of the work can be appreciated in this excerpt: "The water and soil of Japan excel those of all other countries, and the qualities of its people are supreme throughout the eight corners of the earth. For this reason, the boundless eternity of its gods and the endlessness of the reign of its sacred line, its splendid works of literature and glorious feats of arms, shall be as enduring as heaven and earth."