formula (n.) Look up formula at Dictionary.com
1630s, "words used in a ceremony or ritual," from Latin formula "form, draft, contract, regulation; rule, method, formula," literally "small form," diminutive of forma "form" (see form (n.)).

Modern sense is colored by Carlyle's use (1837) of the word for "rule slavishly followed without understanding" [OED].
Men who try to speak what they believe, are naked men fighting men quilted sevenfold in formulae. [Charles Kingsley, "Letters," 1861]
Mathematical use is from 1796; use in chemistry is from c.1846.