Smullyan showed musical talent from a young age, playing both violin and piano. He studied with pianist Grace Hofheimer in New York. He had perfect pitch. He started his interest in logic at the age of 5. In 1931 he won a gold medal in the piano competition of the New York Music Week Association when he was aged 12 (the previous year he had won the silver medal). After graduating from grade school, the Depression forced his family to move to Manhattan, and he attended Theodore Roosevelt High School in The Bronx. He played violin in the school orchestra but devoted more time to playing the piano. At high school he fell in love with mathematics when he took a class in geometry. Apart from his classes in geometry, physics, and chemistry, however, he was dissatisfied with his high school, and dropped out. He studied mathematics on his own, including analytic geometry, calculus, and modern higher algebra - particularly group theory and Galois theory. He sat in on a course taught by Ernest Nagel at Columbia University that was being taken by his cousin, Arthur Smullyan, and independently discovered Boolean rings. He also spent a year at the Cambridge Rindge and Latin School. He did not graduate with a high school diploma, but he took the college board exams to get into college. He studied mathematics and music at Pacific University in Oregon for one semester, and at Reed College for less than a semester, before following the pianist Berhard Abramowitsch to San Francisco. He audited classes at the University of California, Berkeley, before returning to New York, where he continued his independent study of modern abstract algebra. At this time he composed a number of chess problems which were published many years later; he also learned magic. At the age of 24, he enrolled at the University of Wisconsin-Madison for three semesters, because he wanted to study modern algebra with a professor whose book he had read. He later transferred to the University of Chicago and majored in mathematics. After a break in which he worked as a magician in New York and met his first wife, he returned to the University of Chicago, where he also worked as a magician at night and taught piano on the faculty at Roosevelt University. While at Chicago he took three courses with the philosopher Rudolf Carnap, for which he wrote three term papers. Carnap recommended that he send the first term paper to Willard Van Orman Quine, which he did. Quine replied that he should tinker with his idea about what makes quantification theory tick. Of the other two term papers, one, entitled "Languages in which Self-Reference is Possible" (which Carnap showed to Kurt Gödel), was later published in 1957. The other was later published in his 1961 book Theory of Formal Systems. While still a student at the University of Chicago, on the basis of a recommendation from Carnap, he was hired by John G. Kemeny, the chair of the mathematics department at Dartmouth College. He taught at Dartmouth for two years. During that time he separated from his first wife, from whom he later divorced. He also used to visit his friends Gloria and Marvin Minsky (Gloria Minsky was his cousin) in Cambridge, Massachusetts. The University of Chicago, after a battle between the faculty and administration, agreed to award Smullyan a bachelor of science degree in mathematics in 1955 based partly on courses he had taught at Dartmouth (although he had not taken them at Chicago). Both Carnap and Kemeny helped him to get accepted to the graduate program in mathematics at Princeton University. He received a PhD in mathematics from Princeton University in 1959. He completed his doctoral dissertation, titled "Theory of formal systems", under the supervision of Alonzo Church, which was published in 1961. While a graduate student at Princeton he met his second wife, Blanche, a pianist and teacher, born in Belgium, to whom he was married for 48 years until she died in 2005.