Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Order of operations
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Conventional order == The order of operations, that is, the order in which the operations in an expression are usually performed, results from a convention adopted throughout mathematics, science, technology and many computer [[programming language]]s. It is summarized as:{{r|BS}}{{r|Mathworld}} # [[Bracket (mathematics)|Parentheses]] # [[Exponentiation]] # [[Multiplication]] and [[Division (mathematics)|division]] # [[Addition]] and [[subtraction]] This means that to evaluate an expression, one first evaluates any sub-expression inside parentheses, working inside to outside if there is more than one set. Whether inside parentheses or not, the operation that is higher in the above list should be applied first. Operations of the same precedence are conventionally evaluated from left to right. If each division is replaced with multiplication by the [[Multiplicative inverse|reciprocal]] (multiplicative inverse) then the [[associative property|associative]] and [[commutative property|commutative]] laws of multiplication allow the factors in each [[Addition#Terms|term]] to be multiplied together in any order. Sometimes multiplication and division are given equal precedence, or sometimes multiplication is given higher precedence than division; see {{slink||Mixed division and multiplication}} below. If each subtraction is replaced with addition of the [[additive inverse|opposite]] (additive inverse), then the associative and commutative laws of addition allow terms to be added in any order. The [[radical symbol]] {{tmath|\sqrt{\vphantom t} }} is traditionally extended by a bar (called [[vinculum (symbol)|vinculum]]) over the radicand (this avoids the need for parentheses around the radicand). Other functions use parentheses around the input to avoid ambiguity.{{r|OMS}}{{r|NIST}}<ref group="lower-alpha" name="NB2"/> The parentheses can be omitted if the input is a single numerical variable or constant,{{r|BS}} as in the case of {{math|sin ''x'' {{=}} sin(''x'')}} and {{math|sin ''Ο'' {{=}} sin(''Ο'')}}.<ref group="lower-alpha" name="NB2"/> Traditionally this convention extends to [[monomial]]s; thus, {{math|sin 3''x'' {{=}} sin(3''x'')}} and even {{math|sin {{sfrac|1|2}}''xy'' {{=}} sin({{sfrac|1|2}}''xy'')}}, but {{math|sin ''x'' + ''y'' {{=}} sin(''x'') + ''y''}}, because {{math|''x'' + ''y''}} is not a monomial. However, this convention is not universally understood, and some authors prefer explicit parentheses.<ref group="lower-alpha" name="NB3"/> Some calculators and programming languages require parentheses around function inputs, some do not. {{anchor|Grouping}} Parentheses and alternate symbols of grouping can be used to override the usual order of operations or to make the intended order explicit. Grouped symbols can be treated as a single expression.{{r|BS}} ===Examples=== Multiplication before addition: : <math>1 + 2 \times 3 = 1 + 6 = 7 .</math> Parenthetical subexpressions are evaluated first: : <math>(1 + 2) \times 3 = 3 \times 3 = 9 .</math> Exponentiation before multiplication, multiplication before subtraction: : <math>1 - 2 \times 3 ^ 4 = 1 - 2 \times 81 = 1 - 162 = -161 .</math> When an expression is written as a superscript, the superscript is considered to be grouped by its position above its base: : <math>1+2^{3+4} = 1+2^7 = 1+128 = 129 .</math> The operand of a root symbol is determined by the overbar: : <math>\sqrt{1 + 3} + 5 = \sqrt 4 + 5 = 2 + 5 = 7.</math> A horizontal fractional line forms two grouped subexpressions, one above divided by another below: : <math>\frac{1 + 2}{3 + 4} + 5 = \frac{3}{7} + 5.</math> Parentheses can be nested, and should be evaluated from the inside outward. For legibility, outer parentheses can be made larger than inner parentheses. Alternately, other grouping symbols, such as curly braces {{nowrap|{ }}} or square brackets {{nowrap|[ ]}}, are sometimes used along with parentheses {{nowrap|( )}}. For example: : <math>\bigl[ (1 + 2) \div (3 + 4) \bigr] + 5 = (3 \div 7) + 5 </math>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)