Suppose you have written a derivative that pays the squared value of the stock price at maturity T=1; that is, it pays S3(1). The stock currently trades at S(0)=100. Your model is a single period binomial tree with up value for the stock equal to 102 and the down value equal to 98. One dollar deposited at time zero into the risk-free asset returns 1.01 dollars at maturity.

Enter the number of shares that the replicating portfolio holds (if selling short, use the minus sign):

>>Enter the cost of the replicating portfolio:

To determine the number of shares in the replicating portfolio, we can use the concept of risk-neutral valuation. In a binomial tree model, the value of the derivative at time t=0 is equal to the expected discounted value of the derivative at maturity T=1 under the risk-neutral probabilities.

In this case, since the derivative pays S^3(1) at maturity T=1, we need to find the expected value of S^3(1) under the risk-neutral probabilities.

To do this, we can calculate the value of S(1) at both the up and down states of the binomial tree. From there, we can compute the expected value of S^3(1) by weighting the values at each state by their respective probabilities.

Let's calculate the values at time t=1 in both the up and down states:

Value at time t=1 in the up state: S(1) = S(0) * up value = 100 * 102 = 10200
Value at time t=1 in the down state: S(1) = S(0) * down value = 100 * 98 = 9800

Next, we need to calculate the risk-neutral probabilities. The risk-neutral probabilities can be calculated as the discount rate divided by the up and down factors. In this case, the discount rate is given as 1.01, so we have:

Risk-neutral probability of up state: p = (1 + r - down value) / (up value - down value)
= (1.01 - 98) / (102 - 98)
= 0.0075

Risk-neutral probability of down state: 1 - p = 1 - 0.0075 = 0.9925

Finally, we can calculate the expected value of S^3(1) using the weighted average of the values at each state:

Expected value of S^3(1) = p * (S(1) at up state)^3 + (1 - p) * (S(1) at down state)^3
= 0.0075 * (10200)^3 + 0.9925 * (9800)^3

Calculating this expression gives us the expected value of S^3(1).

To determine the number of shares in the replicating portfolio, divide the expected value of S^3(1) by the current stock price S(0). This will give us the number of shares needed for the replicating portfolio.