Arithmetic Expressions

Outline for Arithmetric Expressions

An arithmetic expression is an expression built up using numbers, arithmetic operators (such as +, -, / and ) and parentheses, "(" and ")".    Arithmetic expressions may also make use of exponents, for example, writing  23as an abreviation for ((22)2).

An arithmetic expression in which the only operators are +,, - and exponentiation, is called a simple arithmetic expression. Here are some examples:

  1. 5 --  a number is an arithmetic expression
  2. (3 + 4) -- the  sum of numbers is an arithmetic expression
  3. (7 - 3) --  the difference  of two  numbers is an arithmetic expression
  4. (2 5),    25 -- a product of two numbers is an arithmetic expression.  We indicate the product with either a "times sign", "" or a raised dot, "".   The raising of the dot is important as it makes it easy to distinguish a product from a decimal.  For example, it allows us to distinguish 314 from 3.14.
  5.  (6 (3 + 4)),   6(3 + 4)  -- by using parentheses we can indicate the order in which the operations are to be done.  In this example the parentheses indicate that the addition is to be done before the multiplication.
  6. 6(3 + 4)-- This is another way of writing (6 (3 + 4)).   It is a common practice to omit the product sign when one factor is surrounded by parentheses.  The multiplication is indicated by the juxtaposition of factors.
  7. ((3 + 4)(6 - 2)) -- This is another example of juxtaposition.  It is the same as writing ((3 + 4)(6 - 2)) .  The same convention is used when both factors are parenthesized.
  8. 23 -- this is an abbreviation for the arithymetic expression ((22)2)
  9. (23 + 5) -- this is an abbreviation for the arithmetic expression (((22)2) + 5)
  10. (23 + 5)2 -- this is an abbreviation for the arithmetic expression (23 + 5)(23 + 5)
  11. 7 - 6 + 2 -- while  expressions involving several operators are sometimes written without using parentheses this is only allowed when rules are given that indicate how the parentheses should be inserted.  Such rules are called precedence rules.  We shall introduce some precedence rules at a later point,  for the time being we will always put in the parentheses.
Simple arithmetic expressions can always be evaluated  to a number.
  1. 5 --  is already evaluated, its value is 5.
  2. (3 + 4) --  evaluates to 7
  3. (7 - 3) -- evaluates to 4
  4. (2 5),   (25) -- evaluate to 10.
  5.  6 (3 + 4),   6(3 + 4)  -- evaluate to 42 =7 .
  6. 6(3 + 4)-- evaluates, again, to 42.
  7. (3 + 4)(6 - 2) -- evaluates to 28= 74.
  8. 23 -- evaluates to ((22)2) = 8 .
  9. (23 + 5) -- evaluates to (((22)2) + 5) =  (8+5) = 13.
  10. (23 + 5)2 -- evaluates to  ((23 + 5)(23 + 5)) = ((8+5)(8+5)) = (1313) = 169.
  11. 7 - 6 + 2 -- can be evaluated in two ways, depending on which operation we perform first. Note that the two parenthesized versions of this expression, 7 -( 6 + 2) and ( 7 - 6 ) + 2, evaluate to different values:  the first evaluates to -1 but the second evaluates to 3.So, unless we have a precedence rule which tells us where to put in the parentheses, and thus tells us in which order to perform the operations,  the evaluation of the expression is ambiguous.


There are two ways to get avoid the ambiguity problem presented in the last example.  One is to have formal (strict) rules for writing arithmetic expressions so that there are always enough parentheses so that we always know in which order to perform the operations.  The other is to have "precedence rules" which tell us how to evaluate an expression --  in effect they  tell us how to insert parentheses.

Formal Rules for writing  Simple Formal Arithmetic Expressions.

  1. Every number is a  simple  formal arithmetic expression
  2. if  e and e'are simple  formal arithmetic expression then so is the expression ( e + e')
  3. if  e and e' are simple  formal arithmetic expression then so is the expression ( e - e')
  4. if  e and e' are simple  formal arithmetic expression then so is the expression ( e  e')
  5. if  e is a simple  formal arithmetic expression and n is a positive integer then (e)n is a simple  formal arithmetic expression
  6. An arithmetic expression is a simple  formal algebraic expression if, and only if, it is obeys these rules.
Rules for evaluating Simple Formal Arithmetic expressions
 
  1. Evaluate the expression beginning with the expression in the  innermost parentheses and work outwards.
Examples:
  1. ((5 + 4) -3) = (9-3) = 6
  2. ((7)2)3 =  ((7 7)) = (49) = ((49 49) 49) = (240149) = 117649
Rules for writing  Simple Informal Arithmetic Expressions
 
  • Every number is a  simple  informal arithmetic expression
  • if  e and e'are simple  informal arithmetic expression then so is the expression ( e + e')
  • if  e and e'are simple  informal arithmetic expression then so is the expression e + e'
  • if  e and e' are simple  informal arithmetic expression then so is the expression ( e - e')
  • if  e and e'are simple  informal arithmetic expression then so is the expression e - e'
  • if  e and e' are simple  informal arithmetic expression then so is the expression ( e  e')
  • if  e and e'are simple  informal arithmetic expression then so is the expression e'
  • if  e is a simple  informal arithmetic expression and n is a positive integer then (e)n is a simple  informal arithmetic expression
  • if  e is a simple  informal arithmetic expression and n is a positive integer then en is a simple  informal arithmetic expression.  Actually this rule is not really satisfactory in the case that e is of the form  ap, for some expression a, as the notation ap n is possibly confusing and it is better to write  (ap)n.
  • An arithmetic expression is a simple  informal algebraic expression if, and only if, it is obeys these rules. However, in practice we will relax this rule and, for example,  use notations such as 3or 3(5+2) for,  respectively, 34 and 3(5+2).
  • Precedence Rules for evaluating simple informal arithmetic expressions
     
    1. Evaluate the expression beginning with the expression in the  innermost parentheses and working outwards.
    2. When evaluating a parenthesis-free expression perform  the operations in the following order:
      1. evaluate all factorials from left to right
      2. do all multiplications from left to right
      3. do additions and subtractions from left to right


    Examples:

    1.  7 - 6 + 2 = 1 + 2 = 3
    2. 7 - (6 + 2) = 7-8 = -1
    3. 5 + 62 + 1 = 5+ 12 + 1 = 17 + 1 = 18
    4. (5 + 6) (2+1) = 11(2+1) = 113 = 33

    EXERCISES

    Here is a form that will produce examples of informal arithmetic expressions for use to both increase and test your ability to evaluate arithmetic expressions. The underlying  program produces arithmetic expressions by making random choices -- it will frequently produce examples that are either too difficult (too big) or too simple (e.g., a single number) to be worthwhile working out. When that happens just produce another expression by clicking on the "make Arithmetic Expression" button.

    To produce an arithmetic expression  in this box 
    press this button 

    Type your answer in this box  and click  and find out that your answer is 

    Click  to display the answer in this box .  If the answer to a problem is a very big number it will be written in  "scientific form" (e.g. -2.3657625038504908e+24 which is another way of writing  -2.36576250385049081024  or -2365762503850490800000000 ).