In 1835, aged 14, Paranhos was sent to the Imperial capital, Rio de Janeiro, to continue his studies. At the beginning of the following year he was admitted into the Naval Academy.[2][12] To help support his education, Paranhos tutored his classmates.[13] In 1841, when he was 22, he graduated with the rank of midshipman, enrolling in the Army's Military Academy.[14] He pursued a course in engineering and developed a penchant for mathematics.[4][15] Prior to graduation from the Army Academy, he was promoted to second lieutenant in the Navy and became a substitute teacher in the Naval Academy.[13][16] In 1842, he married Teresa de Figueiredo Faria, whose family had also come from Porto in Portugal.[13][17]