Algebraic Manipulation of Postfix Equations
Date: 05/14/2003 at 19:57:02 From: Aaron Stubbendieck Subject: Algebraic Manipulation of Postfix Equations Is it possible to solve a postfix equality algebraically, or does it need to be converted back to infix notation? For example: Infix: (5+4x)^5 = (2x-1)/3 Postfix: 4x(5+^5) = 2x(1-)3/ Because the order of operations is not directly associated with the affected terms, it is difficult to decide how to manipulate the components. If 2x is divided out, the result is 2(5+^5) = (1-)3/ Which cannot be converted to infix. I've tried things like removing the operator that was required to make the change, in the example above, removing the / on the right side, but to no success. Is it simpler to just work with equations in infix form?
Date: 05/15/2003 at 17:05:26 From: Doctor Peterson Subject: Re: Algebraic Manipulation of Postfix Equations Hi, Aaron. What a fascinating question! I don't think I've ever even considered doing algebra on postfix notation. In theory, surely it should be possible, since postfix is just a different way to say the same thing; but the rules will have to be stated in a different way, and may be more awkward. If nothing else, trying this should get us to think carefully about what we are really doing in algebra, rather than just following rules we've learned, which now seem "natural." To begin with, we should use a different equation, because the one you chose can't be solved in infix form either. There is no general solution to fifth degree polynomials. I'd like to try first solving a slightly complicated linear equation, and then try a quadratic. If I forget, remind me I wanted to see what standard form for a polynomial looks like in postfix form, and how we can apply the quadratic formula as well as solving by factoring and by completing the square. So let's solve this: 4(x - 3) = 2x + 2 In infix form, we would first simplify (eliminating the parentheses and putting it into a standard polynomial form as a sum of terms), and then collect x's on one side and constants on the other: 4x - 12 = 2x + 2 4x - 12 + 12 = 2x + 2 + 12 4x = 2x + 14 4x - 2x = 2x + 14 - 2x 2x = 14 x = 7 Now let's put the equation into postfix form: x 3 - 4 * = x 2 * 2 + Note that I didn't use a parenthesis as you did to indicate multiplication, but put in an explicit multiplication symbol. In postfix form you can't leave multiplication implied, and you can't use parentheses. Some other things about your postfix form suggest you don't have a solid grasp on how this form works, so let me know if you need more help with it. There's one more thing we should consider: if we're to be consistent about postfix, shouldn't the equals sign be postfix, too? It can be considered as an operator that takes two expressions and returns as its value a true or false to indicate whether they are equal. Then our equation would look like this: x 3 - 4 * x 2 * 2 + = This way, nothing is between the two things it refers to; so there are no left and right sides at all. That sure messes up the rules we're used to; and it makes it very hard to find where we want to work. There may be a way to do this, but at least for now I'd rather leave the equation itself as infix, so we can see two sides to it: x 3 - 4 * = x 2 * 2 + Now we have to figure out how to simplify an expression. There are no parentheses to eliminate; but we'd like to have a standard form in which we multiply a variable by a coefficient, then add terms. So our standard form for a linear expression would be x a * b + which corresponds to ax + b How can we change x 3 - 4 * into this form?? We'll need to learn the properties of addition and multiplication in postfix form: addition multiplication --------------------- --------------------- commutative: a b + = b a + a b * = b a * associative: a b c + + = a b + c + a b c * * = a b * c * distributive: a b + c * = a c * b c * + identity: a 0 + = a a 1 * = a inverse: a -a + = 0 a 1/a * = 1 inverse oper: a b - = a -b + a b / = a 1/b * a a - = 0 a a / = 1 Those give us some rules for manipulating an expression without changing its meaning. Just as we think of the distributive property as telling us we can move the multiplier inside the parentheses, now we will want to find ways to describe these manipulations so they are easy to remember. For now, I'll just have to refer to this list. So to simplify our expression (which means, moving + to the right), we have to use the distributive property: x 3 - 4 * = x 4 * 3 4 * - = x 4 * 12 - (Note that I had to work with a subtraction rather than an addition; that required me to justify what I did by writing a subtractive version of the property: (a - b) * c = a*c - b*c ==> a b - c * = a c * b c * - Eventually, we will have to get used to postfix ways of thinking of subtraction as addition of a negative.) Now I have this equation: x 4 * 12 - = x 2 * 2 + We can next undo the last operation on each side (compare this with what I did before in infix): x 4 * 12 - = x 2 * 2 + x 4 * 12 - 12 + = x 2 * 2 + 12 + To make the 12's cancel, I have to use the associative, commutative, and inverse properties together, which work this way: a b + b - = a b b + - = a b b - + = a 0 + = a x 4 * 12 - 12 + = x 4 * The equation is now x 4 * = x 2 * 14 + (Notice how I used the associative property to add the 2 and 12 on the right.) Now we have to commute and subtract 2x from both sides: x 4 * = 14 x 2 * + x 4 * x 2 * - = 14 x 2 * + x 2 - x 4 * x 2 * - = 14 Then I combine like terms by factoring (distributive property in reverse): 4 2 - x * = 14 2 x * = 14 And at last I can commute and divide both sides by 2: x 2 * = 14 x 2 * 2 / = 14 2 / x = 7 We did it! It looked pretty weird, didn't it? Yet I imagine if we were used to it, we could do it just as easily as we do it in infix now, because it would become familiar. And it's actually helpful that the last operation performed is always at the right, so it is natural to undo "from the outside in," which in infix form is a lot harder to recognize. That's the mistake you made in your attempt: you can only work on the right of an expression, not on the left. Whether we could do this with the equality written in postfix is another question. On the whole, I think I'm happy to stick with infix notation. If you have any further questions, feel free to write back. If you're interested in quadratics, I'll let you try it yourself first, and you can show me what you find. - Doctor Peterson, The Math Forum http://mathforum.org/dr.math/
Search the Dr. Math Library:
Ask Dr. MathTM
© 1994-2013 The Math Forum