Cui Yuan was born in the commandery of Lecheng in what is now modern Hebei province. He was the son of Cui Yin, who died while Yuan was in his teens. After years of study, he ventured to the Han capital at Luoyang when he was eighteen. There he studied under Jia Kui and befriended notable persons such as the scholar and commentator Ma Rong and the prolific inventor, mathematician, scientist, and official Zhang Heng . Cui gained a reputation as a with his work on reforming the Chinese calendar and as a scholar following his commentary on the ''Book of Changes''.