We consider an investment into WBNB-CAKE LP tokens. *Impermanent Loss (IL)* is the difference between the revenue of a pure investment into the volatile assets (WBNB and CAKE) and an investment into the LP tokens.

Recall that **the variation of the price of the LP token is proportional to** $\sqrt{r \times s }$, where $r$ and $s$ are the variations of the prices of WBNB and CAKE respectively. Therefore an investment in WBNB-CAKE LP tokens generates revenues proportional $\sqrt{r \times s }$.

However we should also take into account that there is a yield farming interest $r^{\mathrm{LP}}$ per LP token derived from any source - trading fees, subsidies, reward tokens. If this interest is reinvested into the pool for compounding and not removed as payout, then total revenue is given by

$\sqrt{r\times s}\times (r^{\mathrm{LP}}+1).$

On the other hand, for a pure 50/50 investment in WBNB and CAKE, the revenue is proportional to the variations $r$ and $s$ of the prices of WBNB and CAKE:

$\frac{r+s}{2}$

**Impermanent Loss (IL) is the difference between the revenue of an investment into the LP tokens and a pure investment into the volatile assets** (WBNB and CAKE):

$\mathrm{IL}=\sqrt{r\times s}\times (r^{\mathrm{LP}}+1)-\frac{r+s}{2}={\color{blue}\sqrt{r\times s}-\frac{r+s}{2}} + {\color{green}\sqrt{r\times s}\times r^{\mathrm{LP}}}.$

The last equality is particularly helpful to quantify Impermanent Loss. If we neglect the yield farming interest, $r^{\mathrm{LP}}=0$, then impermanent loss simply consists in the blue term. By the Arithmetic-Geometric mean inequality, this is always negative: ${{\color{blue} \sqrt{r\times s}-\frac{r+s}{2}}<0}$.

Therefore, in the absence of yield farming interest, **an investment into LP tokens is always loosing against a pure investment into each token of the pair**. The higher the difference between the variations $r$ and $s$ of the prices of WBNB and CAKE, the bigger will be the Impermanent Loss.

This is why the yield farming interest $r^{\mathrm{LP}}>0$ is crucial, as then the yield farming revenue ${\color{green}\sqrt{r\times s}\times r^{\mathrm{LP}}}$ can compensate for the loss ${{\color{blue} \sqrt{r\times s}-\frac{r+s}{2}}<0}$.

Next, let us assume that the price of one token does not change, for instance $s=1$. This happens for instance when CAKE is replaced with a stable coin. Then the revenue of a pure investment in WBNB is given by the price evolution $r$. Therefore the investment in LP tokens beats IL if:

$\sqrt{r}\times (r^{\mathrm{LP}}+1) \geq r \Longleftrightarrow (r^{\mathrm{LP}}+1)^2\geq r.$

Similarly the investment in LP tokens is sub-optimal whenever:

$\sqrt{r}\times (r^{\mathrm{LP}}+1) \leq r \Longleftrightarrow (r^{\mathrm{LP}}+1)^2\leq r.$

Note that the investment in LP token can even tolerate significant drops in asset price down to

$\sqrt{r}\times (r^{\mathrm{LP}}+1) \geq 1 \Longleftrightarrow r\geq \frac{1}{(r^{\mathrm{LP}}+1)^2}.$

The situation is summarised in this graphic: