# Spend twice as much effort every time you attempt to solve a problem

**In brief**:  in order to iteratively solve problems of unknown difficulty a good heuristic is to double your efforts every time you attempt it.

Imagine you want to solve a problem, such as getting an organization off the ground or solving a research problem. The problem in question has a difficulty rating $d$, which you cannot know in advance.

You can try to solve the problem as many times as you want, but you need to precommit in advance how much effort $e$ you want to put into each attempt - this might be for example because you need to plan in advance how you are going to spend your time.

We are going to assume that there is little transfer of knowledge between attempts, so that each attempt succeeds iff the amount of effort you spend on the problem is greater than its difficulty rating $e > d$.

The question is - how much effort should you precommit to spend on each attempt so that you solve the problem spending as little effort as possible?

Let's consider one straightforward strategy. We first spend $1$ unit of effort, then $2$, then $3$, and so on.

We will have to spend in total $1 + 2 + \dots + d  = \frac{1}{2}(d+1)d \in \mathcal{O}(d^2)$. The amount of effort spent scales quadratically with the difficulty of the problem.

Can we do better?

What if we double the effort spent each time?

We will have to spend $1 + 2 + 4 + \dots +2^{\lceil \log_2 d \rceil} = 2\cdot 2^{\lceil \log_2 d \rceil } - 1 \le 4d - 1\in \mathcal{O}(d)$. Much better than before! The amount of effort spent now scales linearly with the difficulty of the problem.

In complexity terms, you cannot possibly do better - even if we knew in advance the difficulty rating we would need to spend $d \in \mathcal{O}(d)$ to solve it.

Is doubling the best scaling factor? Maybe if we increase the effort by $1.5$ each time we will spend less total effort.

In general, if we scaled our efforts by a factor $b$ then we will spend in total $1 + b + b^2 + \cdots + b^{\lceil \log_b d \rceil} = \frac{b^{\lceil \log_b d \rceil + 1} - 1}{b-1} \le \frac{b^2d - 1}{b-1}$. This upper bound is tight at infinitely many points, and its minimum is found for $b = 1 + \sqrt \frac{d-1}{d}$ \- which asymptotically approaches $2$ as $d$ grows. Hence $2$ seems like a good heuristic scaling factor without additional information on the expected difficulty. But this matters less than the core principle of increasing your effort exponentially.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/0adfa679609f0f0dbfe42dcaf0024a509c1860420ca6e7e3.png)

Total effort spent vs scaling factor, for difficulties 10, 1e4, 1e9. The effort zigzags up and down, hitting local minima for scaling factors that allow us to hit the target difficulty exactly after a number of iterations. But if we look at the silhouette delineated by the upper bounds of the function we can appreciate a robust minimum slightly below 2. 

Real life is not as harsh in our assumptions - usually part of the effort spent carries over between attempts and we have information about the expected difficulty of a problem. But in general I think this is a good heuristic to live by.

Here is an (admittedly shoehorned) example. Let us suppose you are unsure about what to do with your career. You are considering research, but aren't sure yet. If you try out research, you will learn more about that. But you are unsure of how much time you should spend trying out research to gather enough information on whether this is for you.

In this situation, before committing to a three year PhD, you better make sure you spend three months trying out research in an internship. And before that, it seems a wise use of your time to allocate three days to try out research on your own. And you better spend three minutes beforehand thinking about whether you like research.

*Thank you to Pablo Villalobos for double-checking the math, creating the graphs and discussing a draft of the post with me.*