Butterfly spread max payoff

why is there a Xm - Xl term? (strike price medium - strike price low). I thought the max payoff would only depend on selling two calls, minus the cost of the two other calls.

Long Butterfly Max Payoff = X2-X1+premium Max Loss = premium Short Butterfly Max Payoff = premium Max Loss = X2-X1-premium

think about it - you make the most with the fly spread when the options you’re selling (the middle ones) expire at the money, rendering them worthless. at this point your low call is worth the most it will be before you start losing money on the short middle option. payoff for fly: max(0,S-X low) - c low -2max(0, S- X mid) + 2c mid + max(0,S-X high) - c high max when s = X mid so, max prof = X mid - X low - c low -2X mid + 2 X mid - c high = X mid - X low - c low - c high