Hacker News new | ask | show | jobs
by rudolf0 4200 days ago
That's exactly how I solved it. I'd consider myself a pretty decent programmer, but I did poorly in algebra and calculus at middle, high school, and university level.

Give me "x + (x + 1) + (x + 2) = 69" and I wouldn't know where to start. I could probably turn that word problem into that equation, but I would have no idea how to actually solve the equation algebraically.

But given the word problem alone I knew to divide by 3 and add the neighboring numbers. Now, actually dividing by 3 I'd need to use a calculator or spend a lot of time with a pencil and paper, but at least I knew the steps to solve it.

I'm awful at rote math and mental math, which is why I'm thankful I can make the computer do it for me.

2 comments

Are you saying that if the word problem was "2 consecutive numbers and a third number that was five higher than the second number" you'd be unable to solve it?

"Tricks" work for simple cases. Algebra works for all cases.

Yeah, I would be unable to solve it, given that I'm pretty sure there is no solution if we assume that "consecutive" implies integers (and I'd be curious what 'consecutive' means if we don't).

If instead we made it "2 consecutive numbers and a third number that was five higher than the second number add up to 70" (i.e., 21 + 22 + 27), that's easily solved using 'tricks'. Really, the trick mention (which is what I did in my head, too) is just a rephrasing of the algebra. That is, I would subtract 4 off of the thing that is 5 higher (so that it's now 1 higher; the problem is now the same, get 3 consecutive integers), subtract 4 off of the number I'm trying to get (so 66), so the problem is now 3 consecutive integers that equal 66, and solve the same way (66/3 = 22, so -> 21, 22, 23), and then just add the four back in to the highest (21, 22, 27).

You're right, my mistake. That "five higher" should have been "four higher".

The thing is that your solution is the algebraic solution. You're simplifying an equation by balancing both sides, when you subtract four. Just from our perspective, you simplify to a still difficult state, instead of the easiest possible state.

Algebra is just a way of formally stating what you did, and then offering some simplifications that speed up the process. Or offering more powerful methods that making solving more difficult problems easier.

'The thing is that your solution is the algebraic solution'

I agree. That's why I said

'Really, the trick mention(ed) ... is just a rephrasing of the algebra'

Just because you do number juggling in your head rather than write it formulaically doesn't make it an inferior technique, or make it not algebra, which was my point.

> Give me "x + (x + 1) + (x + 2) = 69" and I wouldn't know where to start.

You memorize a few rules about what things you're allowed to do, then you apply the rules to simplify the problem in front of you. Sometimes, the hard part is that you don't know one of the rules you need to know. Other times, it's figuring out which of the rules you need to know that you should use. By practicing lots of problems, you get a good intuition for which direction to go, but it's not uncommon with more difficult problems to take the wrong way and end up confused.

First, we're allowed to drop the parentheses with addition (the "associative" rule for addition), so

x + x + 1 + x + 2 = 69

Now we put the similar terms together:

x + x + x + 1 + 2 = 69

How many Xs do we have? Three. Another way of writing that is 3x. So replace that part. Also, 1+2=3, so we'll replace that as well. "Apply rule and replace" is pretty much the most fundamental mathematical operation.

3x + 3 = 69

Let's get rid of the 3 by subtracting it from both sides to keep the equation balanced. On the left side the 3 cancels out (that's why we did this). On the right, we get 69-3, which is 66.

3x = 66

At this point, we just divide by 3 and simplify.

x = 66/3 x = 22

Our numbers are x (22), x+1 (23) and x+2 (24) according to how we listed them in the original problem.