The weights for the two components in the replicating portfolio are determined by solving two equations in two unknowns. Take any node in the option value tree one period before expiration. From that node, there are two branches: one representing the final value of the option if the underlying goes up in price in the final period (call it

) and the other, the final value of the option if the underlying goes down in price in the final period (call it

). Let

represent the investment in the underlying asset in the replicating portfolio and let

represent the number of units of money that are borrowed or lent at the one-period interest rate,

. Finally, let

be the price of the underlying at our chosen node, which we can deduce from the binomial tree for the price of the underlying. Since the value of the replicating portfolio in the final period is to be equal to the value of the option in the final period, the following two equations must hold, and can be solved to obtain expressions for

and

:

For a call option, the replicating portfolio will consist of a long position in the underlying, partially financed by borrowing in the money market. For a put option, it consists of a short position in the underlying, combined with lending in the money market. To obtain the value of the option at the chosen node, the expressions for

and

are substituted into the expression for the value of the replicating portfolio in that period,

. The same procedure can be done on all the nodes one-period from expiration. Once all the values of the option one-period from expiration are determined, one can move back through the tree and perform the same operation on all the nodes two periods before expiration, and so on, until the single node representing the current value of the option is reached.