# Expression Evaluation, More About Operators and Operands

Now, let's consider this situation:

2 * 3

The asterisk, '*', in the above equation is meant to show multiplication. So, the above reads 'two times three'.

Therefore, in this example the operation of multiplication is shown by '*'. And we say that the symbol '*' is the multiplication operator.

There are other ways to show multiplication. An 'X' is often used, and sometimes a dot is used, and sometimes just placing two variables next to each other means multiplication. But for now, let's just use an asterisk to designate multiplication.

Notice that multiplication is a binary operation. That is, the multiplication operator, '*', is a binary operator. It accepts two operands. In the above example the two operands are the number 2 and the number 3.

The multiplication operator above accepts the two operands, performs multiplication arithmetic with them, and produced the value six. The value six can be represented by the number 6, so, we can write:

6 = 2 * 3 The division operator, '/', is also a binary operator. Consider this expression:

10 / 5

This would read 'ten divided by five'.

The division operator here accepts two operands, the number 10 and the number 5, and divides the left one by the right one. This produces a value of two. The value of two can be represented by the number 2, so we can write:

2 = 10 / 5

Division and multiplication have equal precedence. Consider this expression:

10 / 5 * 3

As with the similar case involving addition and subtraction, here we proceed from left to right when operators have equal precedence.

So, the ten is divided by five. This produces a value of two. This value of two is next multiplied by the value of three to produce a value of six. The value of six can be represented by the number 6, so we have:

6 = 10 / 5 * 3

Here's what we have so far:

• Multiplication and division are both binary operators.
• Multiplication and division have equal precedence.
• Again, when operators have equal precedence, evaluation happens from left to right.

Now, understand that multiplication and division have precedence over addition and subtraction. Consider this expression:

3 + 2 * 4

The multiplication operator, '*', accepts operands, the numbers 2 and 4, before the addition operator, '+'. Therefore, two times four produces a value of eight; three added to eight produces a final value of eleven. This evaluation can be viewed this way:

3 + 2 * 4

3 + 8

11

So, we can write:

11 = 3 + 2 * 4

Here are some more examples to show how multiplication, division, addition, and subtraction interact.

Consider:

3 + 8 / 4 - 1

Here, division has precedence over addition and subtraction. So, it accepts operands first. Eight divided by four is two, effectively changing the expression to this:

3 + 2 - 1

Now, addition and subtraction have equal precedence. Addition is to the left, so it accepts operands first. Three added to two equals five. So, effectively we now have:

5 - 1

Finally, the subtraction operator accepts operators. Five take away one is four. So, we can say:

4 = 3 + 8 / 4 - 1 Also consider:

2 * 4 - 12 / 3

In this expression both the multiplication operator, '*', and the division operator, '/', have precedence over the subtraction operator, '-'.

Both the multiplication operator and the division operator have equal precedence, so we proceed from left to right with them. That makes the multiplication operator accept operands first. Two multiplied by four is eight. So, we effectively have:

8 - 12 / 3

Next in line is the division operator. Twelve divided by three is four, effectively giving us:

8 - 4

And, of course, finally, eight take away four is four. So, we say:

4 = 2 * 4 - 12 / 3 In summary, so far:

• Binary operators take two operands.
• Addition, subtraction, multiplication, and division are all binary operations.
• Multiplication and division have precedence over addition and subtraction.
• When two operators have equal precedence, the one to the left accepts operands first.

Where are you?

Here: More about Operators and Operands

Custom Search