At Kazan University, Lobachevsky was influenced by professor Johann Christian Martin Bartels (1769–1833). Bartels was a former teacher and friend of German mathematician Carl Friedrich Gauss. Lobachevsky received a Master's degree in physics and mathematics in 1811. In 1814, he became a lecturer at Kazan University, and in 1822 he became a full professor. He served in many administrative positions and was the rector of Kazan University from 1827 to 1846. He retired (or was dismissed) in 1846. After this event his health rapidly deteriorated. In addition to teaching mathematics and physics at Kazan University Lobachevsky also was an astronomy teacher there. 