Heisenberg entered the Maximilians-Gymnasium in Munich in September 1911. He graduated at the top of his class nine years later and entered the University of Munich that same year, 1920. His maternal grandfather, Dr. Nikolaus Wecklein, was still principal of the Gymnasium during Heisenberg's first three years there.
"Of those early days at the Gymnasium I recall that both my interests in languages and in mathematics were awakened rather early."
—Heisenberg
Heisenberg impressed his teachers from the start not only by his drive and ambition, but also by his sheer intelligence. One of his teachers wrote in his grade report: "The pupil is very highly gifted." Nearly every teacher wrote: "He is among the best in the class."
In those days only boys attended a Gymnasium and only male teachers taught there. The main subjects were classical Greek and Latin, for which Heisenberg received grades of all 1's except for a single 2 (1 being the highest, 4 the lowest). His best subjects were the minor ones: mathematics, physics, and religion. His worst subjects were German and athletics.
Despite the school's emphasis on classical language and literature, Heisenberg's interest turned to math and physics. This arose partly from the technological developments of the period--cars, airplanes, telephones, and radio--and partly from the encouragement of his excellent math and science teacher, Christoph Wolff. Heisenberg recalled: "He tried to interest me and give special problems to me. He told me, 'Try to solve that and that.'" Soon Heisenberg had advanced even beyond his teacher.
"With his independent work in the mathematical-physical field he has come far beyond the demands of the school."
—Teacher's report on Heisenberg's final oral exams
Heisenberg studied Einstein's relativity theory entirely on his own, but he was less interested in the physics than in the mathematics. He taught himself calculus when his family asked him to tutor a college student for her final exams. Calculus was not taught at the Gymnasium. During his final oral exams before graduation, Heisenberg gave a demonstration of what he could do by solving the equations of projectile motion with air resistance taken into account. The examiner wrote, "he makes use of infinitesimal calculus and proves that he has already gone far beyond the goal of middle school mathematics."
As a Gymnasium student Heisenberg became especially fascinated with the theory of numbers, the mathematics of the number system, "because," he later recalled, "it's clear, everything is so that you can understand it to the bottom." Such interest was again awakened by his math teacher, who sometimes handed out published research papers to the class, and by Heisenberg's father. The father, worried that his son was neglecting his Latin, brought home old math treatises written in Latin. One of these was the doctoral dissertation of Leopold Kronecker, a famous number theorist. Like Kronecker, and many others, Heisenberg attempted to prove Fermat's famous last theorem after studying an advanced text on number theory. Although the attempt failed, as it has for everyone else until very recently, it did not discourage Heisenberg from his plans to major in mathematics at the university.
Mathematics and homework were not Heisenberg's only activities during those years. Werner was equally interested in music. He studied classical piano with one of the great Munich masters and was presenting school concerts by the age of 12. No evidence survives of any childhood friend during this period.