# Construct a portfolio of European call options with a certain payoff function

My question is similar to Replicate a Portfolio with Given Payoff but I am not quite sure how to apply this to my problem.

A portfolio of European call options on an asset $$S_T$$ has a payoff function given by $$V_T$$ where: $$V_T = 0,\ S_T < A$$ $$V_T = S_T - A , \ A \leq S_T \leq B$$ $$V_T = B - A, \ S_T > B$$

(i) Construct a portfolio $$H_1$$ of European call options with this payoff function.

(ii) Use Put-Call parity to construct a portfolio $$H_2$$ of European put options with this payoff function.

Let $$C_X(S_T)$$ and $$P_Y(S_T)$$ be a call and a put option with strikes $$X$$ and $$Y$$ respectively, then: \begin{align} (\text{i}) \quad V_T &= (S_T-A)1_{\{A\leq S_T\leq B\}}+(B-A)1_{\{S_T>B\}} \\ &=(S_T-A)1_{\{S_T\geq A\}}+(B-S_T)1_{\{S_T\geq B\}} \\ &=(S_T-A)1_{\{S_T\geq A\}}-(S_T-B)1_{\{S_T\geq B\}} \\ &=\max(S_T-A,0)-\max(S_T-B,0) \\ &=C_A(S_T)-C_B(S_T) \\ &=H_1 \end{align} Using Put-Call parity: \begin{align} (\text{ii}) \quad V_T &=C_A(S_T)-C_B(S_T) \\ &=\left(P_A(S_T)+S_T-D_TA\right)-\left(P_B(S_T)+S_T-D_TB\right) \\ &=(P_A(S_T)-P_B(S_T))+D_T(B-A) \\ &=H_2 \end{align} where $$D_T$$ is the discount factor from maturity $$T$$ to the present time.