In 1829 his father was sent to the Cape of Good Hope, where he acted until 1837 as deputy commissary-general, with as neighbour Sir John Herschel, the astronomer, who was a significant influence on the younger William Petrie's interest in science.
After home education in Cape Town, Petrie, with his brother Martin, entered the South African College.
On 28 November and 2 December 1848 Petrie made displays with a lamp of 700 candlepower from the portico of the National Gallery, and on nights in 1849 from the Hungerford suspension bridge in London.
Subsequently Petrie turned his attention to electrochemistry, and superintended large chemical works; he introduced into the processes improvements which he patented.
For many years he was adviser and designer with Johnson, Matthey & Co.[1][2] Petrie died on 16 March 1908 at Bromley, Kent, and was buried there.