He was born at Blandfield House, between
Edinburgh and
Leith, the son of
Alexander Hamilton, Professor of Midwifery at
Edinburgh University. He was educated at
Edinburgh University and
Trinity College, Cambridge, graduating BA in 1816 and MA in 1819. He wrote two textbooks on
analytical geometry,
The Principles of Analytical Geometry (1826) and
An Analytical System of Conic Sections (1828; 5th edn, 1843). He was elected a
Fellow of the Royal Society in 1828 as "a gentleman well versed in mathematics", and was also elected FRS (Edinburgh) in 1822, as well as FRAS and FGS. He became a
curate in
Cambridgeshire in 1825 and the rector of
Wath near
Ripon in 1830, becoming a rural dean in 1847. In 1850 he was appointed
Dean of Salisbury, a position he filled until his death in 1880. He took a great interest in children's education, delivering sermons and writing a book on the subject,
Practical Remarks on Popular Education (1847). He died at the Salisbury deanery in 1880. ==Family==