Understanding Impermanent Loss - The Real Math
Learning Objectives
Define impermanent loss precisely using mathematical terms, not vague descriptions
Derive the IL formula from constant product principles
Calculate IL for any price change including edge cases and extreme movements
Understand why IL exists as a fundamental feature, not a bug
Determine break-even points where fees must exceed IL for profitability
Imagine this scenario:
You deposit $10,000 worth of assets into an AMM pool—$5,000 in XRP, $5,000 in RLUSD. A month later, XRP has doubled in price. Great news, right? Your XRP holding is now worth $10,000! Except... your LP position is only worth $14,142, not the $15,000 you'd have if you'd just held.
Where did the $858 go?
That's impermanent loss.
The pool rebalanced as XRP rose. Arbitrageurs bought cheap XRP from the pool, leaving you with less XRP and more RLUSD than you started with. Your assets are worth more than when you deposited—but less than if you'd simply held them.
This lesson will prove exactly why this happens and show you how to calculate it precisely.
IMPERMANENT LOSS DEFINED
IL = Value of holding - Value of LP position
Where:
├── "Value of holding" = What your assets would be worth
│ if you had NOT deposited to the pool
├── "Value of LP position" = What your LP tokens are worth
│ after the price has changed
└── IL is always ≥ 0 (you never "gain" vs holding)
Key insight:
├── IL is NOT about losing money in absolute terms
├── IL is about underperforming a hold strategy
├── You can have IL while your position gains value
└── This is what confuses people
Example:
├── Deposit: $5,000 XRP + $5,000 RLUSD = $10,000
├── XRP doubles, RLUSD unchanged
├── Holding: $10,000 XRP + $5,000 RLUSD = $15,000
├── LP position: $14,142 (we'll prove this)
├── IL = $15,000 - $14,142 = $858 (5.72% loss vs holding)
└── But you still gained $4,142 in absolute terms!
```
THE "IMPERMANENT" MISNOMER
Called "impermanent" because:
├── IF price returns to entry level
├── THEN IL goes back to zero
├── You would have same value as if you held
└── The loss "disappears"
But:
├── Price may never return
├── If you withdraw, loss becomes permanent
├── "Impermanent" is aspirational, not guaranteed
└── Better name: "Divergence Loss"
The reality:
├── IL is path-independent
├── Only final price vs entry price matters
├── Doesn't matter how price got there
├── At any moment: Current IL = f(current price ratio)
└── Will be zero only if price ratio = 1
```
PRICE RATIO DEPENDENCY
Key insight:
├── IL depends ONLY on how much price changed
├── Not on which direction
├── Not on absolute prices
├── Not on pool size
└── Pure function of price ratio
Price ratio r = New Price / Original Price
Examples:
├── XRP doubles: r = 2.0
├── XRP halves: r = 0.5
├── XRP up 50%: r = 1.5
├── XRP unchanged: r = 1.0 (zero IL)
└── Same formula works for all
Symmetry property:
├── IL at r = 2 equals IL at r = 0.5
├── Doubling and halving produce same IL
├── Because both represent same "divergence"
└── 2× and 1/2× are symmetric around 1.0
```
IL DERIVATION SETUP
Initial state:
├── Pool: x₀ tokens of A, y₀ tokens of B
├── Price of A in terms of B: P₀ = y₀/x₀
├── Total value in B terms: V₀ = x₀·P₀ + y₀ = 2y₀
├── Your share: s (fraction of pool)
├── Your position value: s·V₀
└── Your holdings: s·x₀ of A, s·y₀ of B
After price change:
├── New price: P₁ = r·P₀ (where r is price ratio)
├── New pool state: x₁, y₁
├── Constant product: x₁·y₁ = x₀·y₀ = k
├── New price relation: y₁/x₁ = P₁ = r·P₀
└── Need to find x₁, y₁ in terms of x₀, y₀, r
```
DERIVING NEW POOL COMPOSITION
Given:
├── x₁·y₁ = x₀·y₀ = k (constant product)
├── y₁/x₁ = r·P₀ = r·(y₀/x₀) (new price)
From second equation:
y₁ = r·(y₀/x₀)·x₁
Substitute into first equation:
x₁·[r·(y₀/x₀)·x₁] = x₀·y₀
x₁²·r·y₀/x₀ = x₀·y₀
x₁² = x₀²·y₀/(r·y₀)
x₁² = x₀²/r
x₁ = x₀/√r
Similarly:
y₁ = y₀·√r
Verification:
├── x₁·y₁ = (x₀/√r)·(y₀·√r) = x₀·y₀ ✓
├── y₁/x₁ = (y₀·√r)/(x₀/√r) = y₀·r/x₀ = r·P₀ ✓
└── Both conditions satisfied
Key result:
├── x₁ = x₀/√r (A tokens decrease if price rises)
├── y₁ = y₀·√r (B tokens increase if price rises)
└── Pool rebalances with square root of price ratio
```
LP POSITION VALUE AFTER PRICE CHANGE
Your holdings after price change:
├── A tokens: s·x₁ = s·x₀/√r
├── B tokens: s·y₁ = s·y₀·√r
Value in B terms (at new price P₁ = r·P₀):
V_LP = s·x₁·P₁ + s·y₁
= s·(x₀/√r)·(r·P₀) + s·(y₀·√r)
= s·x₀·P₀·√r + s·y₀·√r
= s·√r·(x₀·P₀ + y₀)
= s·√r·(y₀ + y₀) [since x₀·P₀ = y₀]
= 2·s·y₀·√r
Therefore:
V_LP = V₀·√r (where V₀ = 2·s·y₀ is initial value)
```
HOLD VALUE AFTER PRICE CHANGE
If you had NOT deposited, you'd still have:
├── A tokens: s·x₀
├── B tokens: s·y₀
Value in B terms (at new price P₁ = r·P₀):
V_hold = s·x₀·P₁ + s·y₀
= s·x₀·r·P₀ + s·y₀
= s·r·y₀ + s·y₀ [since x₀·P₀ = y₀]
= s·y₀·(r + 1)
= V₀·(r + 1)/2
Therefore:
V_hold = V₀·(r + 1)/2
```
THE IMPERMANENT LOSS FORMULA
IL = V_hold - V_LP
= V₀·(r + 1)/2 - V₀·√r
= V₀·[(r + 1)/2 - √r]
IL as percentage of hold value:
IL% = 1 - V_LP/V_hold
= 1 - [V₀·√r]/[V₀·(r + 1)/2]
= 1 - 2√r/(r + 1)
FINAL IL FORMULA:
┌─────────────────────────────────┐
│ IL% = 1 - 2√r/(r + 1) │
│ │
│ Where r = P_new/P_original │
└─────────────────────────────────┘
This formula gives IL as fraction of what you'd have if you held.
Multiply by V_hold to get dollar IL.
```
IL TABLE FOR COMMON PRICE RATIOS
| Price Change | r value | √r | 2√r/(1+r) | IL % |
|---|---|---|---|---|
| -75% (÷4) | 0.25 | 0.50 | 0.800 | 20.00% |
| -50% (÷2) | 0.50 | 0.707 | 0.943 | 5.72% |
| -25% | 0.75 | 0.866 | 0.989 | 1.03% |
| -10% | 0.90 | 0.949 | 0.997 | 0.26% |
| No change | 1.00 | 1.00 | 1.000 | 0.00% |
| +10% | 1.10 | 1.049 | 0.998 | 0.23% |
| +25% | 1.25 | 1.118 | 0.994 | 0.60% |
| +50% (1.5×) | 1.50 | 1.225 | 0.980 | 2.02% |
| +100% (2×) | 2.00 | 1.414 | 0.943 | 5.72% |
| +200% (3×) | 3.00 | 1.732 | 0.866 | 13.40% |
| +300% (4×) | 4.00 | 2.00 | 0.800 | 20.00% |
| +400% (5×) | 5.00 | 2.236 | 0.745 | 25.46% |
Key observations:
├── IL accelerates as price diverges further
├── IL is symmetric: 2× and 0.5× have same IL
├── Small moves (<25%) have minimal IL (<1%)
├── Large moves (>100%) have significant IL (>5%)
└── Extreme moves (>300%) approach catastrophic IL
```
EXAMPLE 1: XRP Doubles
Initial deposit:
├── 2,000 XRP at $2.50 = $5,000
├── 5,000 RLUSD = $5,000
├── Total = $10,000
After XRP doubles to $5.00:
├── r = 5.00/2.50 = 2.0
├── IL% = 1 - 2√2/(2+1) = 1 - 2.828/3 = 1 - 0.943 = 5.72%
Hold value:
├── 2,000 XRP × $5.00 = $10,000
├── 5,000 RLUSD = $5,000
├── Total = $15,000
LP position value:
├── V_LP = V_hold × (1 - IL%)
├── V_LP = $15,000 × 0.9428 = $14,142
IL in dollars:
├── IL = $15,000 - $14,142 = $858
├── You "lost" $858 compared to holding
└── But still gained $4,142 in absolute terms
What's in your LP position:
├── XRP: 2,000/√2 = 1,414.21 XRP
├── RLUSD: 5,000 × √2 = 7,071.07 RLUSD
├── Value: 1,414.21 × $5 + $7,071.07 = $14,142.12 ✓
```
EXAMPLE 2: XRP Drops 50%
Initial deposit:
├── 2,000 XRP at $2.50 = $5,000
├── 5,000 RLUSD = $5,000
├── Total = $10,000
After XRP falls to $1.25:
├── r = 1.25/2.50 = 0.5
├── IL% = 1 - 2√0.5/(0.5+1) = 1 - 1.414/1.5 = 1 - 0.943 = 5.72%
Same IL as doubling! (Symmetric)
Hold value:
├── 2,000 XRP × $1.25 = $2,500
├── 5,000 RLUSD = $5,000
├── Total = $7,500
LP position value:
├── V_LP = $7,500 × 0.9428 = $7,071
IL in dollars:
├── IL = $7,500 - $7,071 = $429
├── Same 5.72%, but smaller absolute loss
└── Because base (hold value) is smaller
What's in your LP position:
├── XRP: 2,000/√0.5 = 2,828.43 XRP
├── RLUSD: 5,000 × √0.5 = 3,535.53 RLUSD
├── Value: 2,828.43 × $1.25 + $3,535.53 = $7,071.07 ✓
└── Note: MORE XRP than you started with (pool bought during decline)
```
EXAMPLE 3: XRP goes 5×
Initial deposit:
├── 2,000 XRP at $2.50 = $5,000
├── 5,000 RLUSD = $5,000
├── Total = $10,000
After XRP 5× to $12.50:
├── r = 12.50/2.50 = 5.0
├── IL% = 1 - 2√5/(5+1) = 1 - 4.472/6 = 1 - 0.745 = 25.46%
Hold value:
├── 2,000 XRP × $12.50 = $25,000
├── 5,000 RLUSD = $5,000
├── Total = $30,000
LP position value:
├── V_LP = $30,000 × 0.7454 = $22,362
IL in dollars:
├── IL = $30,000 - $22,362 = $7,638
├── Massive 25.46% underperformance
├── But still +$12,362 absolute gain
└── Painful in hindsight, still profitable
What's in your LP position:
├── XRP: 2,000/√5 = 894.43 XRP
├── RLUSD: 5,000 × √5 = 11,180.34 RLUSD
├── Value: 894.43 × $12.50 + $11,180.34 = $22,360.72 ✓
└── Much less XRP (pool sold into the rally)
```
EXTREME IL SCENARIOS
If XRP goes to 0:
├── r = 0
├── IL% = 1 - 0 = 100%
├── LP position = 0 (all XRP, worthless)
├── Hold value = RLUSD component only
└── Total loss of XRP value, same as holding XRP
If XRP goes to ∞:
├── r → ∞
├── IL% → 1 - 0 = 100%
├── LP position = √∞ × initial (infinite in theory)
├── But you'd have almost no XRP
└── Hold would have given you infinite value too
These extremes show:
├── IL can approach 100% in extreme divergence
├── You never "lose everything" just from IL
├── You lose relative to what you could have had
├── At extremes, holding was dramatically better
└── But LP still captures some upside (or downside protection)
```
IL MECHANISM EXPLAINED
The AMM is a counterparty to all trades.
When price moves, arbitrageurs trade against the pool.
Price rises (XRP goes up):
├── Pool's XRP becomes "cheap" vs external market
├── Arbitrageurs buy XRP from pool
├── Pool receives RLUSD, gives up XRP
├── LP ends up with less XRP, more RLUSD
├── "Sold the winner too early"
└── Would have been better holding the XRP
Price falls (XRP goes down):
├── Pool's XRP becomes "expensive" vs external market
├── Arbitrageurs sell XRP to pool
├── Pool receives XRP, gives up RLUSD
├── LP ends up with more XRP, less RLUSD
├── "Bought the loser all the way down"
└── Would have been better holding the RLUSD
In either direction:
├── AMM systematically buys falling assets
├── AMM systematically sells rising assets
├── This is the OPPOSITE of momentum investing
├── It's mean-reversion by construction
└── Bad strategy in trending markets
```
IL AS LP COST
Think of IL as:
├── The price you pay to be a liquidity provider
├── Compensation for taking the other side of trades
├── Similar to market maker inventory costs
└── Must be offset by fee income for profitability
LP Profitability equation:
├── Net Return = Fee Income - IL
├── If fees > IL: Profitable
├── If fees < IL: Unprofitable
├── Simple but often ignored
Why LPs accept IL:
├── Fee income compensates for IL
├── In low-volatility environments, IL is small
├── Stablecoin pairs have minimal IL
├── Some LPs misjudge their actual returns
└── Yield farming rewards may supplement (historically)
```
ADVANCED INTERPRETATION: SELLING OPTIONS
IL is mathematically equivalent to:
├── Selling a combination of options
├── You give up upside participation (like selling calls)
├── You take downside exposure (like selling puts)
├── Fee income is your option premium
└── This is "selling volatility"
Option analogy:
├── High volatility = expensive options = high IL
├── Low volatility = cheap options = low IL
├── Fees = premium received for selling options
├── Profitable when premium > realized volatility cost
└── Classic option seller strategy
For sophisticated LPs:
├── LP = Short straddle/strangle equivalent
├── Profits when price stays stable
├── Loses when price moves significantly
├── Should be sized accordingly
└── Delta-hedging can offset (advanced)
```
BREAK-EVEN CALCULATION
For LP to be profitable:
Fee Income ≥ IL
Fee income depends on:
├── Pool trading volume
├── Fee percentage
├── Your share of pool
├── Time period
IL depends on:
├── Price movement only
├── Larger movements = more IL
└── Time doesn't matter directly
Example calculation:
├── Deposit $10,000 to pool with 0.3% fee
├── Pool volume: $1M/day, your share: 1%
├── Daily fee income: $1M × 0.003 × 0.01 = $30/day
├── Monthly fee income: $30 × 30 = $900 (9% monthly return)
IL tolerance:
├── If XRP moves less than 50% either direction
├── IL < 2.02% = $200
├── Monthly profit: $900 - $200 = $700
├── Still profitable despite IL
├── If XRP doubles:
├── IL = 5.72% = $572
├── Monthly profit: $900 - $572 = $328
├── Still profitable but much lower return
├── If XRP 5×:
├── IL = 25.46% = $2,546
├── Monthly loss: $900 - $2,546 = -$1,646
├── IL exceeds fee income, net negative
```
BREAK-EVEN ANALYSIS
Given expected fee income, what price movement breaks even?
Formula approach:
├── IL% = 1 - 2√r/(r+1) = Fee%
├── Solve for r (quadratic after transformation)
├── Complex algebra, use numerical methods
Approximate rules:
├── 1% fee income can absorb ~50% price move
├── 5% fee income can absorb ~2× or ÷2 price move
├── 10% fee income can absorb ~2.5× price move
├── 25% fee income can absorb ~5× price move
Example:
├── Expected monthly fees: 2% of deposit
├── Break-even IL: 2%
├── From table: 2% IL ≈ 1.5× price move
├── If XRP moves <50% either way, profitable
├── If XRP moves >50%, fees don't cover IL
└── This defines your risk tolerance
```
TIME AND IL
IL is instantaneous (not cumulative):
├── IL at any moment = f(current price ratio)
├── Doesn't accumulate over time
├── Only depends on entry vs current price
└── Time matters for fees, not for IL
Fee accumulation:
├── Fees DO accumulate over time
├── Longer LP = more fee income
├── Longer LP = more time for price to move
└── Trade-off between accumulation and divergence risk
Strategy implications:
├── Short-term LP: Low fee accumulation, low price divergence risk
├── Long-term LP: High fee accumulation, high price divergence risk
├── Volatile markets: Short-term safer
├── Stable markets: Long-term maximizes fees
└── No universal "right" answer
The paradox:
├── You want high volume (more fees)
├── High volume often means high volatility
├── High volatility means more IL
├── Must find pairs where fees > IL
└── Often stable pairs with decent volume
```
VOLATILE PAIRS (XRP/ETH, XRP/BTC, etc.)
Characteristics:
├── Both assets move independently
├── Price ratio can change dramatically
├── High IL risk
└── Requires very high fee income to compensate
Example: XRP/ETH pool
├── XRP up 50%, ETH down 20%
├── XRP/ETH ratio change: 1.5/0.8 = 1.875× (87.5% increase)
├── IL% = 1 - 2√1.875/(1.875+1) = 1 - 2.739/2.875 = 4.73%
├── Significant IL from both assets moving
When to LP volatile pairs:
├── Very high fee tiers (1%+)
├── Very high volume
├── Short time horizons
├── Or: Deliberate strategic exposure
└── Generally NOT recommended for passive LP
```
STABLE-VOLATILE PAIRS (XRP/RLUSD, XRP/USDC)
Characteristics:
├── One asset moves, one stays stable
├── IL from the volatile asset only
├── Standard case (our examples above)
└── Most common LP scenario
IL Profile:
├── Moderate IL risk
├── Depends entirely on volatile asset movement
├── Stablecoin side provides "anchor"
└── More predictable than volatile-volatile pairs
When to LP stable-volatile pairs:
├── If you believe in long-term hold of volatile asset
├── Fee income can offset moderate movements
├── Comfortable with "buying dips" automatically
├── Understand you'll underperform pure holding in strong trends
└── Most accessible entry point for new LPs
```
STABLECOIN PAIRS (RLUSD/USDC, USDC/USDT)
Characteristics:
├── Both assets pegged to same value ($1)
├── Price ratio stays near 1.0
├── Minimal IL risk
└── Low but consistent fee income
IL Profile:
├── Near-zero IL in normal conditions
├── Both assets should maintain peg
├── Only risk: Depeg events
Example: RLUSD/USDC pool
├── Normal: Ratio fluctuates 0.99-1.01
├── At r = 1.01: IL = 0.002% (negligible)
├── Even at r = 1.05: IL = 0.06%
└── IL effectively zero for practical purposes
When to LP stablecoin pairs:
├── Want yield with minimal risk
├── Fee income is pure return (no IL offset needed)
├── Lower yields but predictable
├── Good for larger capital allocations
└── Risk: Depeg can cause massive IL suddenly
```
✅ IL formula is mathematically exact. The derivation follows directly from constant product constraints. IL% = 1 - 2√r/(r+1) is precisely correct.
✅ IL is unavoidable in constant product AMMs. It's a mathematical consequence, not a design flaw or implementation bug.
✅ IL only depends on price ratio. Not on absolute prices, pool size, or time—only how much price diverged from entry.
⚠️ Future price movements. You can calculate IL for any scenario but can't predict which scenario will occur.
⚠️ Fee income projections. Volume fluctuates; historical fees don't guarantee future fees.
⚠️ Whether stablecoin pairs will remain pegged. Depeg events can cause sudden massive IL.
📌 Ignoring IL when evaluating LP returns. APY figures often show fees only, not net of IL.
📌 LPing volatile pairs expecting "passive income." IL in trending markets can dwarf fee income.
📌 Not calculating IL before depositing. You should model scenarios before committing capital.
IL is a real cost that must be offset by fee income for LP to be profitable. The math is exact and calculable. Most LPs underestimate IL or ignore it entirely, leading to disappointment. Understanding IL won't eliminate it, but it lets you make informed decisions about which pools to enter and when to exit.
Assignment: Build a comprehensive impermanent loss calculator with scenario analysis.
Requirements:
Initial Token A quantity
Initial Token A price
Initial Token B quantity (stablecoin assumed at $1)
New Token A price
Price ratio (r)
IL percentage
Hold value
LP position value
IL in dollar terms
Current Token A quantity in position
Current Token B quantity in position
90+ rows of data
Graph the relationship (IL% vs price ratio)
Highlight symmetry around r = 1
Calculate what price movements break even
Show range where LP is profitable
Create visual "profitability zone"
Conservative (±10% price movement)
Moderate (±25% price movement)
Volatile (±50% price movement)
Trending bull (2× price increase)
Trending bear (2× price decrease)
IL in percentage and dollars
Required fee income to break even
Assessment of LP attractiveness
Select one real pool
Input actual current parameters
Calculate IL for realistic scenarios
Assess whether you would LP (and why/why not)
Calculator accuracy (30%)
Scenario analysis completeness (25%)
Break-even analysis quality (20%)
Personal assessment thoughtfulness (25%)
Time Investment: 3-4 hours
Knowledge Check
Question 1 of 4A pool position is worth $12,000 after XRP doubled. Holding the original assets would be worth $14,000. What is the impermanent loss?
- "Uniswap: A Good Deal for Liquidity Providers?" (Pintail)
- "Calculating Impermanent Loss" (various DeFi educational resources)
- Formal IL proofs in academic papers
- Online IL calculators
- DeFi dashboards with IL tracking
- Pool analytics platforms
- "Impermanent Loss in Uniswap v3" (more complex with concentrated liquidity)
- Option pricing parallels to IL
- Delta hedging strategies for LPs
For Next Lesson:
Now that we understand impermanent loss, Lesson 4 will examine LP tokens—how they're minted, how they accrue value, and how to track their worth over time. We'll build on IL understanding to create complete LP position models.
End of Lesson 3
Total words: ~6,400
Estimated completion time: 60 minutes reading + 3-4 hours for deliverable
Key Takeaways
IL = Underperformance vs holding.
You can gain value in absolute terms while still experiencing IL. IL measures what you "lost" by LP-ing instead of holding.
IL% = 1 - 2√r/(r+1).
This single formula, where r is price ratio, tells you IL for any price change. Memorize or bookmark it.
IL is symmetric.
A 2× increase and a 2× decrease (÷2) produce identical IL of 5.72%. Divergence in either direction hurts.
IL accelerates with divergence.
Small moves (<25%) have <1% IL. Large moves (>2×) have >5% IL. Extreme moves approach catastrophic.
Profitability requires fees > IL.
Before LP-ing, estimate fee income and compare to IL scenarios. If IL could exceed fees in realistic scenarios, reconsider. ---