# Difference between formula and algorithm

What is the difference between the terms formula and algorithm in mathematics? I haven't seen the definition of formula anywhere. I know that algorithm means that Turing machine halts for every input. Is for example

$$x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}$$ formula or algorithm as $\pm$ means you can choose which sign you use? Are there any formulas that are not algorithms or algorithms that are not formulas?

• I don't remember anything called formula in formal mathematics. I think algorithm is metalanguage term. algorithm tells a computer or a person how to do something. Pure mathematics, I think, never tells how to do something! – user59671 Mar 14 '13 at 20:18
• @CutieKrait There are plenty of algorithms and formulas in pure mathematics. – Alexander Gruber Mar 14 '13 at 20:25
• @AlexanderGruber: yep. But probably these are better terms: formula = equality, and algorithm = proof. – user59671 Mar 14 '13 at 20:33
• @CutieKrait No, that is not correct. – Alexander Gruber Mar 14 '13 at 20:37
• however these are wolfram definitions: wolframalpha.com/input/?i=formula : wolframalpha.com/input/?i=algorithm – user59671 Mar 14 '13 at 20:48

An algorithm is in its most general definition: a way of achieving a desired goal. Formula are merely recipes or components.

Example: The actual method of baking bread with steps is an algorithm:

1. get ingredients
2. mix ingredients
3. put in oven
4. cook until certain time at certain temperature
5. take out and wait till cools

in here would be formula such as the formula for the bread, what ingredients etc...

The quadratic formula is just that: a formula for solving quadratic equations

An example of an algorithm for solving quadratics would be:

1. get quadratic: call a the coefficient in front of x^2, b the coefficient in front of x and c the constant coefficient.

2. evaluate quadratic formula (both + and - versions) on given a, b and c

3. simplify

This algorithm solves the actual problem... whereas the formula is a tool used in the process.

• while this example of picking coefficients and simplifying might seem obvious... for more complicated problems the distinction between algorithm and formula gets even clearer because much more complicated steps and subtleties are formed. If you explore computer science a little you will see what I mean. – frogeyedpeas Mar 14 '13 at 20:30

An algorithm is a method for solving a problem, but a formula is a sequence of numbers and symbols corresponding to a word in a language. The quadratic formula is an algorithm, because it is a method for solving quadratic equations. Algorithms may not even involve math, but formulas almost exclusively use numbers.

• I think I haven't met the definition of a method but your answer seems reasonable. Nice to know that the quadratic formula is an algorithm although it contains the sign $\pm$. – guest Mar 14 '13 at 20:16
• More precisely, the quadratic formula suggests an algorithm for solving quadratic equations; specifically, evaluating the formula. – Hurkyl Mar 14 '13 at 20:30

An algorithm is a formula as well as a procedure. Therefore conceptually a formula is a subset of an algorithm. Algorithms can be defined either in a procedure or a formula. As someone mentioned above baking a bread is a procedure and its definitely an algorithm. Moreover the quadratic equation mentioned above is a formula as well as an algorithm. Therefore we can not separate as two distinct concepts rather they are related. At the end of the day the main purpose of an algorithm is to solve a problem. Two different algorithms can solve the same problem.

• I appreciate this answer a lot more now. 3 years back what felt apparent is not so true today :) – frogeyedpeas Apr 27 '17 at 12:06

An algorithm is a systematic method to achieve a variable Goal with different Quantitative or Qualitative Components;

A Formula is a systematic method to achieve a constant or Fixed Goal With Similar Arithmetical or Algebraic components

Example: try above same examples