If you're reconstructing a payoff as a linear sum of call options, then the procedure is quite simple -> since the payoff of a call is zero up to the strike, and then linear, you start on the left (i.e. most negative value) and move to the right.
example 1: long butterfly spread, strikes of 80, 100, 120.
- start at zero. gradient of payoff is zero: hold no zero strike calls.
- Move to next change of gradient: 80. Gradient is now 1, so we must be long 1 call at strike 80.
- Move to next change of gradient: 100. Gradient is now -1, but the gradient of our current portfolio of calls is 1 since we are already holding a call at a lower strike. Solution: sell 2 calls, portfolio gradient is now -1.
- Move to next change of gradient: 120. Gradient is now zero, but the gradient of our current portfolio of calls is -1 since we are already holding (net) negative one call at a lower strikes. Solution: buy 1 call, portfolio gradient is now 0.
result: long one 80 strike call, short two 100 strike calls, long one 120 strike call.
You can apply the same logic to any (continuous) european payoff.
silly example: long put, strike 100.
- start at zero. gradient of payoff is -1. short 1 zero strike call.
- move to next change of gradient: 100. payoff is now flat, so we must buy a 100 strike call to flatten out the gradient of our call option portfolio.
result: short 1 zero strike call, long a 100 strike call. note that a zero strike call is just the same as holding the stock - we're saying that a put is equivalent to a call plus a short position in the stock -> i.e. put call parity.