He was one of three children and two sons of James Lockhart, a Scottish banker, and his wife Mary Harriot Gray or Grey, from a Quaker family; John Ingram Lockhart was his brother, and the daughter was Mary Harriett, married name Greenwollers. He was educated at Reading School and Eton College. Lockhart worked as a banker in Pall Mall, London, in his father's firm Lockhart, Wallace, & Co. He became a partner, and set up the Cattle Insurance Company. Retiring from the bank in 1799, he moved north to the Windermere area after the death of his first wife. Lockhart knew Walking Stewart, and stated he had learned from him. He knew also William Combe, and the idea for Combe's "Dr Syntax" has been attributed to him. He taught mathematics to his own children, and pupils including Joshua King. For about 15 years Lockhart and his family resided in the Netherlands, from 1819, in Leyden and then Haarlem. He returned to England on the death in 1835 of his brother John, who left no heir. Living first at Aylesbury, Lockhart moved to the rectory at Cowley in 1837. After a legal case on his brother's will, the estate at Cowley was sold in 1841. He moved to Brompton. In 1847 his address was given as Lanhams, near Braintree, Essex. Taking a lease on shooting on the Scottish island of Raasay, Lockhart spent time from 1845 on the Isle of Skye. He then lived in an Argyllshire mansion. He moved in 1851 to Clitsome House near Washford in Somerset. He died there the following year.
Works
Lockhart proposed challenge problems on the separation of the roots of equations of degree five and six, some being published in 1841. He was still writing on the theory of equations while in Argyllshire. The challenges were considered by Florian Cajori to have influenced the work of John Radford Young; William Rutherford noted an analysis by Young of an equation proposed by Lockhart, in a book of 1849. Detailed analysis of a quintic using Budan's theorem for separation of roots was given in 1842, by James R. Christie; it was noted by Young. In 1843 Young commented that Budan's approach, and Lockhart's own ideas, could now be simplified on the basis of recent developments, which had led to Sturm's theorem. Young also commended books by Lockhart in discussing a problem on roots proposed by John Pell to Silius Titus. Lockhart and Young then influenced the subsequent work of Rehuel Lobatto. Lockhart's books were mostly self-published:
A Method of Approximating Towards the Roots of Cubic Equations Belonging to the Irreducible Case
Nieuwe en algemeene leerwijze om biquadraten op te lossen waarbij de systemas van Descartes en Euler tot biquadraten met derzelver tweede termen worden voortgezet
Nieuwe oplossing van cubiek-vergelykingen door juiste uitdrukkingen, en ook bij nadering, zonder beproeving of gissing
Extension of the celebrated theorem of C. Sturm, whereby the roots of numeral equations may be separated from each other, with copious examples
Resolution of Two Equations
Resolution of Equations by Means of Inferior and Superior Limits
The Nature of the Roots of Numerical Equations
Family
Lockhart married twice. With his first wife, Mary Coxe, daughter of Leonard Coxe of Philadelphia, a dispossessed loyalist of the American Revolution, he had three daughters and a son. With his second wife Elizabeth, whom he married in 1805, he had six sons and two daughters; she died in 1843 at age 56. Lockhart's children included:
James, the eldest son, a barrister and poet; James Augustus Lockhart, officer in the 41st Regiment, killed at age 21 on 8 September 1855 in the Crimean War was his son.