In October 1833, at the age of 20, Gregory entered Trinity College, Cambridge, receiving his B.A. in 1837, being ranked fifth wrangler, and his M.A. in 1841. However his interests were not only in mathematics for at Cambridge he continued to pursue his interest in chemistry which he had shown while an undergraduate at Edinburgh University.
Noong Oktubre 1833, sa edad na 20, Gregory ipinasok Trinity College, Cambridge, tumatanggap ng kanyang BA sa 1837, na ranggo ikalima nakikipagbangayan, at ang kanyang MA sa 1841. Subalit sa kanyang mga interes ay hindi lamang sa matematika para sa Cambridge siya patuloy na ituloy ang kanyang interes sa kimika na ipinakita niya habang ang isang undergraduate at Edinburgh University.