back
132 comments
This is not that uncommon when optimizing code.

Your program is slow so you profile it, and find out that f() takes 99% of the time. So you work a lot to optimize f(), and re-profiling shows that now f() takes 98% of the time.

Doesn't seem that impressive after all the work you've put into optimizing f(), but your program is actually twice as fast :)

This just shows that the percentage of total time a function takes is really not the thing you should be looking at when optimizing code and you want to know how much faster your code really is.

For example, say your function f() takes 100% of the time. You then make it twice as fast. You look at the percentage, and, surprise, it still is taking 100% of the time!

This is an interesting observation, and confirms the way I optimise code:

1) Create a benchmark (some code that performs the task that I want to optimise), and measure the absolute time it needs.

2) Use a profiler to see where most of the time is spent. Optimise that code.

3) Run benchmark to see if your optimisation are effective.

Or, in other words: the percentage tells you where to focus your effort. The absolute time tells you how successful your optimisation is.

Without knowing your code, I can think of a performance hack to get the running time of f() down to less than 10% of the time.
If you understand Amdahl's law, it's not suprising at all!
beautiful
One of the people I went to university with had a little (very short) mental catalogue of "chromatic mathematical fruit jokes". There are exactly two famous ones. "What's purple and commutes?" "An abelian grape." And: "What's yellow and equivalent to the axiom of choice?" "Zorn's lemon." He invented another, which requires more esoteric knowledge: "What's green and determined up to isomorphism by its first Chern class?" "A lime bundle." I don't remember whether anyone found a credible fourth example.

(Oh, how we laughed.)

[In case anyone reading this thinks the above might be amusing if only they knew what mathematical objects were actually being referred to: (1) No, probably not. (2) Abelian group; Zorn's lemma; line bundle. For the last one, you need to make it the first Stiefel-Whitney class if you're working over the real numbers rather than the complex numbers.]

The Ham Sandwich Theorem may have the best companion image/caption combo I've ever seen on wikipedia

https://en.wikipedia.org/wiki/Ham_sandwich_theorem#/media/Fi...

This is not an implausible basis with which to start a new list on Wikipedia. It is original research, but it will likely be let in.
The Squeeze Theorem in calculus [1] is also known as the "Sandwich Theorem".

[1] https://en.wikipedia.org/wiki/Squeeze_theorem

Just don't discuss this one at the dinner table:

https://en.wikipedia.org/wiki/Hairy_ball_theorem

You should bump it up to five; the ham sandwich theorem references a "pancake theorem" involving the bisection of two layers instead of the ham sandwich's three.
A much more important example of this than "martian potatoes" is uranium enrichment.

Natural uranium is ~1% U235; bombs need 90+% U235. So when you've enriched it from 1% to 2% it doesn't seem like you've made a lot of progress towards 90.

If instead of enriching U235 you think of it as eliminating U238, though, then you've done half of the work.

If instead of enriching U235 you think of it as eliminating U238, though, then you've done half of the work.

That's the wrong way to think of it though. The right way to measure progress is in terms of Separative Work Units: https://en.wikipedia.org/wiki/Separative_work_units

If you start with 10000 kg of natural (0.7%) uranium and you want to separate it into 45 kg of highly-enriched (90% U235) uranium and 9955 kg of depleted (0.3% U235) uranium, then you will have to do 8800 kg of "Separative work units".

On the other hand, separating that same fuel into 3000 kg of partially-enriched (1.4% U235) uranium and 7000 kg of partially-depleted (0.4% U235) uranium only takes 1790 kg of "Separative work units", even though the increased concentration of U235 means that "half the U238 has been eliminated".

Isotope enrichment is an area where, to borrow a line from software engineering, the first 90% takes 90% of the time, and the last 10% takes the other 90% of the time.

Another angle on this problem: How much water must you add to the potatoes to make them 100% water?

Of course, you can add all the water in the universe and they'll still not be 100% water. The water-percent increment just gets smaller and smaller, the more water you add.

This "potato paradox" illustrates the same effect, but in the other direction, where a small relative decrease yields a large absolute decrease.

The solution is much more intuitive if you use odds ratios instead of percentage probabilities. You go from a 99:1 ratio to a 98:2 (or 49:1) ratio.

In other words, it's another way of phrasing that it takes twice as much evidence to be 99% sure as it is to be 98% sure. Or that it's twice as hard to have 99% uptime than 98%.

Cool concept. Took me a minute to think it through before I could make sense of it.

I think it is the fact that they used potatoes that makes it counterintuitive. Had it instead been a glass of water that had 1% of dissolved salt in it, it would have been very straightforward.

The thing the article doesn't point out is why it seems unintuitive.

If you phrased the question as "You have N pounds of potatoes", or with a specific number other than 100, it would come across as less unintuitive. As you read, you see "100 lbs", and "99%", so percents and potato components are both out of 100. So then you see 98%, which is 98/100...

q:100 people are seated in a room. 99% of them are enginners and 1% managers. How many engineers should leave the room to make it 98% enginners and 2% managers? a:50
Here is another variation.

A fresh lake gets infested with algae and the amount of algae doubles every day. The algae covers the whole lake in 10 days. How many days did it take the algae to cover half the lake?

I think it's interesting that just the percentage stated makes it hard to comprehend intuitively.

That is, restate the question with a different end water percentage and the answer is immediately obvious:

> You have 100 lbs of Martian potatoes, which are 99 percent water by weight. You let them dehydrate until they're 50 percent water. How much do they weigh now?

And, of course, it's pretty easy to get "2 pounds", but your brain is pretty fixed on the numbers all clustered together in the other example.

I don't think a simple algebra problem should be called a paradox.
This strikes me as similar to the non-intuitiveness of compounding interest (and related brain teasers like "bacteria doubling population every day" and "pieces of gold doubling on a chess board").
Another intuitive way of thinking is to think in terms of proportionality between water and potato matter. The weight of the potato matter remains constant, and the amount of water can change, which in our case goes down. To make the matter proportionally twice as bigger compared to water, one needs to divide water by twice.
This equation models the amount of weight lost for various percentages of change:

0.99 * 100 - (0.99-x)(100 - y) = y

This assumes that you are starting with 100 pounds of potatoes at 99% water weight. Here's a WolframAlpha link: http://www.wolframalpha.com/input/?i=0.99+*+100+-+%280.99-x%...

This is only a paradox because the framing of the question misleads people , partly by mentioning potatoes, into thinking that they are discussing something that one might actually do in the way it is described. In reality if you did this with real physical objects the part where it says: "You let them dehydrate until they're 98 percent water" hides a process in which one of the operations would involve picking up the potatoes. At this point you would notice that they were much lighter than before.

So as stated it is a trick question, the kind of parlour game found in old books of puzzles.

Finally, it seems to be a common failure of education to allow people to go through their 'mathematical' training and leave them with the impression that 'percent' is some kind of dimension when in fact it is short hand for a ratio: y is x percent of z. If z is not specified then you don't know what y is regardless of how much effort you put into discussing x.

So I suspect that in real life there are not many occasions when the paradox appears surprising.

A better or more shocking way to understand how the numbers interplay is, to reframe this like this. Imagine a vegetable mystical-vegetable, that had 99.9% water and weighed 100 lbs. If I dehydrated it such that it now has 99% water, what would be its weight? Yes, its 10 lbs.
This is bs and you're all witches.
Let p be the percentage of water and m the total mass.

Then m(p) = 1/(1-p) . The "unintuitive" aspect is that we want to think of this function as linear when it isn't.

By taylor's theorem, how bad a linear approximation to this function will be is based on its higher order derivatives. We can get an idea of this by looking at its second derivative:

m''(p) = 2/(1-p)^3. If you plot this graph, you'll see that it really starts to blow up past 0.8, so the nonlinearities start dominating.

This is only confusing because of the potatoes.

If you said you had a pool that was 99% water, that changed to 98% water, the massive weight drop would be much less surprising.

This is related to the base rate fallacy, the maths of which is frequently misunderstood and can lead to very real consequences:

http://metaist.com/blog/2010/02/disease-screening-base-rate-...

Very good. I also like the birthday paradox. https://en.wikipedia.org/wiki/Birthday_problem
This isn't a paradox at all. It's a slightly non-intuitive result.
Took me an embarrassingly long time to figure this out. The key issue that I've latched on to is that they've lost 99 - 98 = 1% of their water content, which is false.
Makes mathematical sense, yet not quite common sense.
But how is that unintuitive?
I'd call it: "The Potato Algebra Problem"
Any more of these interesting puzzles?
Looks like I found my new diet.
Interesting
Why is this a "paradox"? Not sure what this applies to either. It's not even counterintuitive.
That's not interesting at all. How do I downvote submissions?