Variables and terms

It is often helpful to use letters that stand for numbers. These letters are called Variables (or placeholders). With the help of variables, calculation rules (from now on called terms, algebraic expressions, or formulas) can be written down briefly and precisely using the basic operations (,:,+,\cdot, :, +, -). In fact, without variables we would have to write out these calculation rules as a sentence, which is rather complicated and cumbersome. Here are a few examples:

Exercise 1

Write as a term using variables:

  1. "A number is multiplied by 33, and subtracted from another number"

  2. "Multiply one number by another, subtract half of the first number, and add to the result three times the second number."

Solution
  1. Let's call one number xx, the other yy. We then have yx3y-x\cdot 3.
  2. Let's call the first number aa, the second one bb. We have aba2+3ba\cdot b - \frac{a}{2}+3\cdot b.
Exercise 2

Write the following terms as a sentence without using the letters aa, bb, and cc.

  1. 3a+(bc)3a+(b-c)

  2. a+12b1\frac{a+1}{2b-1}

Solution
  1. Multiply the first number by three, and add to the result the value which is obtained by subtracting the third number from the second number.
  2. Increase the first number by 11, and divide the result by the value you get if subtract 11 from twice the second number.

Evaluating terms

If a term is given, we can evaluate it as soon as we know which numerical values the variables should have. It often helps to think of the variables as containers that can be filled with numbers.

For example: The term

3ab+a3a-b+a

contains two containers aa and bb, which do not have to hold the same numbers. But the containers with the same letter always must contain the same number. Perhaps it helps to actually draw containers, say a blue circle \color{blue}\bigcirc for aa and a red circle \color{red}\bigcirc for bb. We have then

3+3{\color{blue}\bigcirc}-{\color{red}\bigcirc}+{\color{blue}\bigcirc}

If a=2{\color{blue}a}={\color{blue}2} and b=3{\color{red}b}={\color{red}3}, we have to put the 2\color{blue}2 into \color{blue}\bigcirc and the 3\color{red}3 into \color{red}\bigcirc and thus get

323+2=53\cdot {\color{blue}2}-{\color{red}3}+{\color{blue}2}=5

For a=2{\color{blue}a}={\color{blue}{-2}} and b=3{\color{red}b}={{\color{red}-3}} we get

323+2=6+32=53\cdot {\color{blue}{-2}} - {{\color{red}-3}}+{\color{blue}{-2}} = -6+3-2=-5

Order of operations and brackets (or parentheses)

Generally speaking, if we add several variables or numbers, or if multiply several variables or numbers, we do this from left to right. For example, say we have the term

a+b+4a+ b+4

and use a=2a=2 and b=3b=3. Then we start on the left and calculate

2+3=52+ 3=5

and then

5+4=95+4=9

However, if there is a mixture of operations, this left to right pattern is not always correct. Often we have small groups (let's call them atomic terms) within a term which must be evaluated first. Basically, there are two cases:

  1. Multiplication and division binds stronger than addition or subtraction. That is, we must evaluate the atomic terms with the dot operators first. For example, consider the term a+5ba+5\cdot b. Here we have to evaluate the atomic term 5b5\cdot b first, because it is separated from the aa by a plus, which binds weaker. Thus, for a=2a=2 and b=3b=3, we have

    53=155\cdot 3=15

    and

    2+15=172+15=17

    Note the a power, e.g. x2x^2 binds stronger than multiplication. So, we have

    352=325=753\cdot 5^2 = 3\cdot 25=75

    So we have the following oder (from binding strongest to weakest):

    ()2and:+and\boxed{\begin{array}{c} ()\\ \boxed{\phantom{}}^2\\ \cdot\quad\text{and}\quad:\\ +\quad\text{and}\quad - \end{array}}
  2. Brackets form atomic terms which must be evaluated first. For example, take the term (a+5)b(a+5)\cdot b. Now, because there is a bracket, we first have to evaluate the atomic term a+5a+5. Thus, for a=2a=2 and b=3b=3 we have

    2+5=72+5=7

    and

    73=217\cdot 3=21

    You can also think like this: Power binds stronger than multiplication, and multiplication binds stronger than addition (and subtraction). But brackets bind the strongest!

    Of course, atomic terms can also contain other atomic terms, as indicated below in colors:

    3x(4xST1+1ST2){{\color{red}3x}}-({\color{green}{\underbrace{4x}_{\text{ST1}}}+{\color{green}{\underbrace{1}_{\text{ST2}}}}})

    Here, red and green are atomic terms, and the green atomic term consists of two other atomic terms ST1 and ST2.

Exercise 3

Evaluate the terms:

  1. 3a+(bc)3a+(b-c) for a=1,b=2,c=2a=1, b=2, c=-2

  2. x+12y1\frac{x+1}{2y-1}, for x=2,y=5x=2, y=5

  3. e+e+eff+12fe+e+e-f-f+\frac{1}{2f}, for e=1,f=2e=1, f=-2

  4. (u)(v)3v+4u(-u)(-v)-3v+4u, for u=3,v=2u=3, v=-2

  5. 5a5a, for a=15a=-15

  6. x34\frac{x}{3}-4, for x=33x=33

  7. a(2x3a)a(2x-3a), for a=3a=3, x=4x=4

  8. (x+y)-(x+y), for x=1x=1, y=13y=13

  9. 3y4ax3y-4ax, for a=2a=2, x=3x=3, y=5y=-5

  10. (x+1)2(x+1)^2, for x=6x=-6

  11. x2+1x^2+1, for x=6x=-6

  12. 5x(3zy)25x-(3z-y)^2, for x=2x=2, y=1y=-1, z=4z=4

  13. 7x(x+3)(yx)7x-(x+3)(y-x), for x=5x=-5, y=2y=2

Solution
  1. 3+(22)=3+4=73+(2--2)=3+4=7
  2. 2+1101=39=13\frac{2+1}{10-1}=\frac{3}{9}=\frac{1}{3}, for x=2,y=5x=2, y=5
  3. 1+1+1(2)(2)+12(2)=3+2+2+14=7+14=714=6.751+1+1-(-2)-(-2)+\frac{1}{2(-2)}=3+2+2+\frac{1}{-4}=7+-\frac{1}{4}=7-\frac{1}{4}=6.75
  4. (3)(2)3(2)+43=(3)(2)6+12=6+6+12=12(-3)(--2)-3(-2)+4\cdot 3=(-3)(2)--6+12=-6+6+12=12
  5. 5(15)=755(-15)=-75
  6. 3334=114=7\frac{33}{3}-4=11-4=7
  7. 3(2433)=3(89)=3(1)=33(2\cdot 4-3\cdot 3)=3(8-9)=3(-1)=-3
  8. (1+13)=(14)=14-(1+13)=-(14)=-14
  9. 3(5)4(2)(3)=1524=393(-5)-4(2)(3)=-15-24=-39
  10. (6+1)2=(5)2=25(-6+1)^2=(-5)^2=25
  11. (6)2+1=36+1=37(-6)^2+1=36+1=37
  12. 52(341)2=10(12+1)2=10132=10169=1595\cdot 2-(3\cdot 4--1)^2=10-(12+1)^2=10-13^2=10-169=-159
  13. 7(5)(5+3)(25)=35(2)(7)=3514=35+14=217(-5)-(-5+3)(2--5)=-35-(-2)(7)=-35--14=-35+14=-21