z

Young Writers Society


PEMDAS and Like Terms



User avatar
72 Reviews



Gender: Male
Points: 1931
Reviews: 72
Mon May 28, 2012 5:18 pm
View Likes
ShadowKnight155 says...



It's these little things that always get me. I'm working on writing a program for doing expressions... but... how do I handle combining like terms and distributing? As in I'm asking if I have the right order. :3

For example, with the expression:
(5x(12x -2x + 4) + 3 + 3x - (6x -2))/2

Nice and complicated, I guess. But at what stage would I combine like terms, and also, when would you distribute? Before or after combining...

Would I just follow PEMDAS in the combining of terms? Like distribute first because it's multiplication? And do this before trying to simplify?

So:
(5x(12x -2x + 4) + 3 + 3x - (6x -2))/2
(50x+ 7 + 3x -6x+2))/2 <<<--- Distribute, combine, distribute...
(47x+ 9)/2 <<<---Combine some more...
then distribute(if that's the right word for division)
23.5x + 4.5

Would that be the right answer? I hope I wasn't too confusing. :P

(BTW, this isn't homework, but I assume anyone in this forum would probably be the most knowledgeable on this. :P)
By nature, all language is flawed.

"Peace cannot be kept by force, it can only be achieved by understanding," - Albert Einstein
  





User avatar
1220 Reviews



Gender: None specified
Points: 72525
Reviews: 1220
Mon May 28, 2012 6:21 pm
View Likes
Kale says...



If there are like terms within parentheses, combining them first is easiest. You can save combining like terms until the very end, but this winds up making the problem more complex, which makes the problem take longer to solve while also increasing the chances of making a mistake (if you're working it out by hand).

I've also found that it's generally a good idea to simplify/combine like terms after each PEMDAS operation. It helps cut down on mistakes.

So, for this:

(5x(12x -2x + 4) + 3 + 3x - (6x -2))/2

I'd combine the like terms in parentheses where possible, then distribute to get this:

(50x^2 + 20x +3 + 3x - 6x + 2)/2

Combining like terms again gets this:

(50x^2 + 17x + 5)/2

or

25x^2 + 8.5x + 2.5

A computer program should have no problem following through PEMDAS without simplifying after each step, though.
Secretly a Kyllorac, sometimes a Murtle.
There are no chickens in Hyrule.
Princessence: A LMS Project
WRFF | KotGR
  








You must never give into despair. Allow yourself to slip down that road, and you surrender to your lowest instincts. In the darkest times, hope is something you give yourself. That is the meaning of inner strength.
— Uncle Iroh