Albert Einstein was born into a Jewish family in Ulm, in the Kingdom of Württemberg in the German Empire on March 14, 1879. His father was Hermann Einstein, a salesman and engineer. His mother was Pauline Einstein (née Koch). In 1880, the family moved to Munich, where his father and his uncle founded a company, Elektrotechnische Fabrik J. Einstein & Cie, that manufactured electrical equipment based on Direct current.
The Einsteins were not observant of Jewish religious practices, and Albert attended a Catholic elementary school. Although Einstein had early speech difficulties, he was a top student in elementary school.
Albert Einstein in 1893 (age 14), taken before the family moved to Italy
When Einstein was five, his father showed him a pocket compass. Einstein realized that there must be something in the space, previously thought to be empty, that was moving the needle and later stated that this experience made "a deep and lasting impression". At his mother's insistence, he took violin lessons starting at age six, and although he disliked them and eventually quit, he later took great pleasure in Mozart's violin sonatas. As he grew, Einstein built models and mechanical devices for fun, and began to show a talent for mathematics.
In 1889, family friend Max Talmud, a medical student, introduced the ten-year-old Einstein to key science, mathematics, and philosophy texts, including Kant's Critique of Pure Reason and Euclid's Elements (Einstein called it the "holy little geometry book"). From Euclid, Einstein began to understand deductive reasoning, and by the age of twelve, he had learned Euclidean geometry. Soon thereafter he began to investigate infinitesimal calculus.
In his early teens, Einstein attended the Luitpold Gymnasium. His father intended for him to pursue electrical engineering, but Einstein clashed with authorities and resented the school regimen. He later wrote that the spirit of learning and creative thought were lost in strict rote learning.
In 1894, when Einstein was fifteen, his father's business failed, as DC had lost the War of Currents to alternating current (AC). In search of business, the Einstein family moved to Italy, first to Milan and then, after a few months, to Pavia. During this time, Einstein wrote his first scientific work, "The Investigation of the State of Aether in Magnetic Fields". Einstein had been left behind in Munich to finish high school, but in the spring of 1895, he withdrew to join his family in Pavia, convincing the school to let him go by using a doctor's note.
Rather than completing high school, Einstein decided to apply directly to the Eidgenössische Polytechnische Schule (later Eidgenössische Technische Hochschule (ETH)) in Zürich, Switzerland. Lacking a school certificate, he was required to take an entrance examination, which he did not pass, although he got exceptional marks in mathematics and physics. Einstein wrote that it was in that same year, at age 16, that he first performed his famous thought experiment visualizing traveling alongside a beam of light (Einstein 1979).
The Einsteins sent Albert to Aarau, Switzerland to finish secondary school. While lodging with the family of Professor Jost Winteler, he fell in love with the family's daughter, Marie. (Albert's sister Maja later married Paul Winteler.) In Aarau, Einstein studied Maxwell's electromagnetic theory. At age 17 he graduated, and, with his father's approval, renounced his citizenship in the German Kingdom of Württemberg to avoid military service, to finally enroll in 1896 in the mathematics and physics program at the Polytechnic in Zurich. Marie Winteler moved to Olsberg, Switzerland for a teaching post.
In the same year, Einstein's future wife, Mileva Marić, also entered the Polytechnic to study mathematics and physics, being the only woman in the group. During the next few years, Einstein and Marić's friendship developed into romance. Einstein graduated in 1900 from the Polytechnic with a diploma in mathematics and physics, whereas Marić failed her final exams. That same year, Einstein's friend Michele Besso introduced him to the work of Ernst Mach. The next year, Einstein published a paper in the prestigious Annalen der Physik on the capillary forces of a straw (Einstein 1901). He gained Swiss citizenship on 21 February 1901.