r/MathHelp • • Aug 30 '21

Having a hard time "solving in order of operations"

I encountered a problem in my logical programming homework that I can't seem to figure by myself. Even though I have a calculator and know the answer, I just can't seem to get solve it. It's the only problem I've encountered in this homework that I haven't been able to solve just with "pemdas".

So the problem is :

(-2)^4 / 4 * 2 + 2^3 /2.

There's some step I'm missing since I get it to 16/8 + 8/2 ( which im quite sure it might be wrong?) which gives me the wrong answer.

I'm back to college again as an adult so I forgot a lot. I know there must be some fundamental error that i can't understand since my calculator shows the result as 12.

EDIT: added the ^s that got lost when i pasted it.

10 Upvotes

26 comments sorted by

5

u/chien-royal Aug 30 '21

In any programming language 16 / 4 * 2 is parsed as (16 / 4) * 2 and not as 16 / (4 * 2).

1

u/dennisdenniston Aug 30 '21

Like I said I'm just starting the semester and not really sure what was the idea of writing it like this and writing other problems from the same set with normal exponents and signs.

3

u/hausdorffparty Aug 30 '21

Mostly so you know what to expect from your calculator's behavior, and where the ambiguities can be when you write something for other people (or your calculator) to compute. How can you make sure your computation is clearly communicated? By making sure it follows PEMDAS and, even better, avoiding any multiplications after divisions in a particular term.

0

u/[deleted] Aug 31 '21

[deleted]

2

u/HorribleUsername Aug 31 '21

sorry i don't know how to tag someones username/comment eek

Just put /u/ in front of their username, no spaces. For example, /u/practicingeternity.

3

u/Kie-Rigby Aug 30 '21

(-2)4 / 4 *2+ 23 /2.

P:E:MD:AS

Multiplication/Division can be in any order. Division can come before multiplication.

The same is true for addition/subtraction.

We first look for parenthesis. There are none.

They we look for exponents

16 / 4 *2+ 8 /2.

We then look for multiplication OR division. We work from left to right. The first we see is 16/4

4*2+8/2

We then see multiplication

8+8/2

We then see division

8+4

We now look for addition OR subtraction from left to right

12

Final answer.

Some things to note:

  1. Using division symbols in this way is not great because of the ambiguity on whether it should be [(-2)4 / 4] *2 or (-2)4 / [4 *2].

  2. Some programming languages will always prioritize multiplication over division or vice versa.

1

u/dennisdenniston Aug 31 '21

Yup! Like the other user suggested, I was giving multiplication priority over division regardless if it came before or after from left to right.

1

u/PoliteCanadian2 Aug 30 '21

It depends, is the ‘* 2’ connected only to the bottom of the fraction or is it sitting outside of the fraction entirely?

If it’s outside the fraction entirely then you’ve got 16/4 * 2 which is 4 * 2 which is 8 then add your fraction at the end.

Otherwise you have 16/(4 * 2) which is 16/8 = 2 then add the fraction at the end.

1

u/dennisdenniston Aug 30 '21

I'm typing it straight from the the homework. Tbh it's the only problem in the set that has stomped me. If I use the traditional left to right pemdas as i did the rest, I get a different answer than If i input it in cymath's solver which gives me the same answer as the calculator, but goes into other ways of solving it, so i don't even know at this point.

1

u/PoliteCanadian2 Aug 30 '21

Well now that I look at it again the end could be the issue. Is it 23 then divided by 2 or is it 23/2. Where is the / in relation to the other numbers?

1

u/dennisdenniston Aug 30 '21

I'm approaching it as 2^3 divided by 2 . The set of problems is about order of operations. These are some of the other exercises from the same set:

9-4*2+3*2

4*3^2-12*3

5^2 – (4^2 + 3^2) / 5

Those I managed to do just fine be using the order of operations. It's only just that last one that I cant wrap my head around.

1

u/[deleted] Aug 30 '21

It is 23 and then divide by 2 since the / 2 is not in parenthesis or small like the exponent.

1

u/edderiofer Aug 30 '21

There's some step I'm missing since I get it to 16/4 + 8/2

Where did the "* 2" go?

1

u/dennisdenniston Aug 30 '21

I’m sorry that’s another typo. I’ve been spamming math work for like a week. It should be 16/8. I’m multiplying /4 by *2

4

u/edderiofer Aug 30 '21

Well, there's your problem. In the order of operations, multiplication and division take equal precedence, and addition and subtraction take equal precedence. To break such ties (and only when breaking such ties), one evaluates from left to right. In short, one performs the operation "16/4" first, then multiplies by 2.

Also, you should be aware that PEMDAS is just a convention and it's often broken in certain circumstances, especially when typing mathematical expressions into a computer. When writing such expressions, one should generally aim for writing an expression that can't be misinterpreted, which sometimes means adding brackets that aren't strictly necessary for the sake of the reader.

2

u/dennisdenniston Aug 30 '21

Thank you so much! That did it. I was automatically giving multiplication priority regardless of its order. Just divided and multiplied from left to right when I solved the exponents and that made sense and got me the answer!

1

u/[deleted] Aug 30 '21

(-2)^4 / 4 * 2 + 2^3 /2

the reason you have a problem with solving that is because this is an incomprehensible form and ambiguous way to write whatever they had in mind.

2

u/dennisdenniston Aug 30 '21

Yeah I guess they're trying to have us recognize how it would be written in machine language or something? I'm not even sure, if i'm honest.

0

u/[deleted] Aug 30 '21

Use PEMDAS and then left to right. I don't think either of your answers are right.

Think of it like this

(-2 x 4 / 4 x 2) + (23 / 2)

I am getting 7.5

1

u/dennisdenniston Aug 30 '21

that's a mistake on my part. i re edited the post cause it was missing the exponents (^)

1

u/[deleted] Aug 30 '21

[removed] — view removed comment

2

u/edderiofer Aug 30 '21

Your comment has been removed because giving out full solutions is not allowed. (See sidebar, rule #2 under "Rules for Answering".)

1

u/AutoModerator Aug 30 '21

Hi, /u/dennisdenniston! This is an automated reminder:

  • What have you tried so far? (See Rule #2; to add an image, you may upload it to an external image-sharing site like Imgur and include the link in your post.)

  • Please don't delete your post. (See Rule #7)

We, the moderators of /r/MathHelp, appreciate that your question contributes to the MathHelp archived questions that will help others searching for similar answers in the future. Thank you for obeying these instructions.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/fermat1432 Aug 30 '21

16/4*2+4=12

1

u/Quendillar3245 Aug 31 '21

order of operations would mean that you treat * and / equally, so (-2)^4/4*2 + 2^3/2 = ((-2)^4/4)*2+2^3/2 = (16/4)*2+8/2 = 4*2+4 = 8+4 = 12.

The only time multiplication is prioritised over division or vice versa is if it's within parenthesis, but that applies for everything.