Friday, 10 October 2014

Fixing Your Intuition - Multiplication

Yesterday I wrote about Mammon in Clicker Heroes and I made a spreadsheet to calculate how many levels of Mammon you should buy based on how many hero souls you have in the bank. I opened with a comment that because Mammon multiplied through your production, he would always be worth buying at some point regardless of how bad his cost-to-effect ratio was.

Thinking back, I'm not sure this is entirely intuitive to everyone but I feel like it should be. I'm not entirely sure this post is going to be helpful to anyone - maybe people already have the right intuition about this kind of thing - but I feel like it's worth talking about a few mental shortcuts that you can use when you are analyzing numbers because it seems to me that probably a lot of people don't have the right intuition about multiplying things together.

Anyone with a passing interest in numbers has probably observed at some point that if you have two numbers that add to a fixed sum and you want to maximize their product then you want to make the two numbers as close to equal as possible. Suppose you have ten points to divide between x and y and they are multiplied together to get some kind of result. The best you can do is 5 and 5 to multiply to 25. 4 and 6 gives 24, 3 and 7 gives 21. That's a fairly simple observation.

Suppose, though, that you have ten points to divide between x and y, and the are multiplied together to get the result, but y is only worth half as much as x? I think intuitively some people see this situation and think that in this case you would put more into x than y because it is worth more. But multiplication is commutative. If you multiply x by half of y that is the same as multiplying x by y and then taking half of that, and the same as mutiplying half of x by y. The answer is still to make them equal.

When we are multiplying things in video games, though, we are often not actually multiplying x and y, we are adding two percentage bonuses. Suppose you have 10 points to divide between x and y and each gives a percentage bonus to the same thing. Again, the best is to divide the points evenly. 1.05 times 1.05 is 1.1025, while 1.04 times 1.06 is only 1.1024. It's a tiny difference that would be bigger if the numbers weren't so small.

In this case, if y is half as effective as x, we aren't directly multiplying x by y anymore, so it isn't the same as if x was half as effective as y. If we add x% to our result and only half of y% to our result, then the best we can do is to put all ten points in x and get a 10% bonus. If we add split the points 9 and 1 then we get 1.09 plus half a percent which is only 1.09545.

But unlike the result above, this does not extend upwards to infinity. Suppose instead of 10 points to distribute we had 200 points to distribute. Now the best we can do is x is 150 and y is 50. This gives us a total of 3.125. Changing it in either direction lowers our result to 3.12495.

How about when we have a million points to divide? Now the correct distribution is to put 500050 points into x and 499950 points into y. No matter how many points we put in, the correct answer is to put 100 more points into x.

More generally speaking, if you adding points to x gives you a% more per point and adding points to y gives you b% more per point, then the optimal value for x is:

Notice that if a = 0.01 and b = 0.005 then this is y + 100 which is just the result we got above. You don't necessarily need to memorize this formula, but the important thing to realize is that no matter what the difference between the effect of x and y on the outcome, if they each give a percentage bonus, then the ideal way to divide points between them is to keep them at a fixed difference from one another depending on the effect they have. So if y is half as effective as x that doesn't mean you put half as many points in, it means you put a constant number fewer points in. If y is one one-millionth as effective as x then again, the answer is to keep them a constant value apart.

As long as the number of points you have to divide is below that constant, you should put all your points into the better option. Once it exceeds that constant, you then divide the remaining points evenly between the "better' and the "worse" option.

This should make sense intuitively if you think about it the right way. Basically by adding percentages we are multiplying 1 + x by 1 + y. If x and y are small then those 1s make a big difference. As they get large that starts to look a lot like just multiplying x by y at which point the commutativity of multiplication kicks in.

Mammon, as I discussed, was more complex, owing to the fact that his cost scales up as you buy more ranks and his effect doesn't provide a linear percentage increase.

So there are three takeaways to this post that you should use to adjust your intuition about numbers if your intuition doesn't already work this way:
  • When you are multiplying two things together, don't be fooled if one of them is only a fraction as good as the other - they should still be kept equal to maximize the result
  • When you are getting percentage bonuses from two different sources there is a threshold up to which you should invest in the better one and after that you should invest equally
  • While for things that have additive effects the question is usually "Is this good or not?", for things that have multiplicative effects the question is always "At what point is this good?

No comments:

Post a Comment