Formal derivation of the hedging concept
Hedging is a transactional process that aims to minimize the risk of the trader's activity. In short, hedging typically refers to the risk offsetting. The risk can be associated with a single transaction (the trade risk) or a number of individual transactions (portfolio risk).
Following trader's activity (buying or selling of financial product), an institution ends up with the position which value can be formally described as:
where: A = amount and represents a risky financial product where price changes follow a Normal Distribution:
To eliminate the fluctuation in the value of the position, an institution considers hedging programme, i.e. taking position in different instrument  say  in order to eliminate the risk.
The task is to determine the quantity of hedging instrument  say amount B  that minimizes the value fluctuation of the original transaction.
We assume that the hedging instrument is a financial product that similar to follows a Normal Distribution. Once the quantity is added to the original transaction, the risk is not any longer univariate (two instruments now constitute a miniportfolio), but now is governed by a bivariate normal distribution
To present this case formally:
 We will create the portfolio of two instruments
 Compute the first two moments  mean and variance
The reader can see that we have computed the portfolio variance by the formula:
Given our objectives, we want to minimize the portfolio's risk, i.e. variance. Although Maple's Optimization routines can be used here, we will apply stepbystep procedures to derive this result explicitly.
We will:
 Differentiate the portfolio variance w.r.t B
 Solve the equation for the quantity B
> 


(3.1.2) 
This is the solution to our problem  we have determined the quantity B = that needs to added to the existing position A to minimize the risk.
The B quantity will be:
 positive if (i) correlation is negative or (ii) amount A is negative (the socalled short position)
 negative if (i) correlation is positive or (ii) amount A is positive (the socalled long position)
We still need to verify that this is the minimum (rather than maximum)
The standard condition for minimizations problems stipulates that
> 


(3.1.3) 
The seconded derivative of the portfolio's variance  MinTest is always positive, so adding the quantity B shown above is indeed the solution to our minimization exercise.
As seen from above, the efficiency of the hedging is a function of three variables: volatility of individual assets and the correlation between the two instruments.
How sensitive is the this amount to the functional input?
 The quantity is primarily affected by the volatility of the hedging instrument
 When is low, the correlation will have more pronounced impact on the hedging scheme
 For higher values of correlation effect will diminish
 This is confirmed in the animation chart below:
Spread Options
Spread options naturally arise in Finance when optionality on future value is taken w.r.t two assets. Spread in finance is usually defined as a difference between the two quantities and can be expressed in terms of difference in (i) prices, (ii) yields, (iii) rates or (iv) spreads themselves (eg. credit spreads).
Spreads options are designed and traded to manage future expectations of assets behavior and allow monetisation of a particular view on their direction and dependency
 If trader expects the spread between two instruments to widen beyond a certain level (the strike), he(she) will buy a Call Option (benefits if
 If, on the other hand, trader predicts the narrowing of the spread, he(she) will buy a Put Option (benefits if
Mathematically, spread options are class of truncated expectations where the expectation is taken w.r.t joint distribution of two instruments in the defined bivariate space.
To value the spread option, we will define:
 each instrument own stochastic process (here we assume that the underlyings are "rates" instruments)
 option types Call and Put Spread Option
> 


(3.2.2) 
The formula above is the "adjusted"payoff of the Call Spread Option in the raw format. It differs from the standard notation by having the usual Max(0.....) notation removed, since we will value this option by taking the discounted expectation of the payoff function over the "eligible" positive domain.
The trick to value an option in bivariate setting is to determine the correct limits of integration for each stochastic variable. We will achieve this in three steps:
 Determine the critical threshold for which the stochastic variable takes greater or lower value  we compute this threshold w.r.t
 Perform the integration using this critical limit in the inner space
 Keep the outer integration along the whole variable domain for the second variable 
> 


(3.2.3) 
This is the required critical threshold
 For Call Option  to ensure the posiitivity of the payoff  we will integrate the probabilityweighted payoff from
 For Put Option  to stay positive we will do the opposite:
This is the desired Call Spread Option expression  a discounted expectation w.r.t bivariate standard normal density with correlation ρ. The discounting is performed with the DF expression outside the integral.
> 

Maple returns a semianalytical result that, unfortunately, cannot be evaluated symbolically any further, so we need to resort to numerical routines, which Maples handles with ease.
All we need is to assign numerical values to each parameter and numerically integrate:
We use the particular case:
 Correlation between S and U: ρ=0.65
 Option maturity T = 1 (year)
 Discount factor DF = 0.96
Here we are valuating a call option that pays the unit of currency (i.e. $1 or ?1 ) if in one year from now the S  U > 0.20% (irrespective of the fact that today U > S)
> 


(3.2.6) 
This is the Call Option Premium obtained numerically.
Now, what is the sensitivity of the option premium w.r.t functional input?
Although we have computed the value numerically, this does not impact Maple's productivity or efficiency:
 It can first perform the differentiation symbolically
 Evaluate the result numerically
For example, we can compute the option's sensitivity w.r.t. each underling rate  the deltas for S and U
What do these values mean?
 If the value of the rate S changes by +1%, then the call option premium will increase by 0.33%
 If the value of the rate U increases by 1% then the call option premium will drop by 0.28%
Maple can be equally efficient in computing any other desired comparative static  gamma (2nd derivative w.r.t rate), vega (derivative w.r.t sigma) etc.
Reader can verify that in the spread option case, the sensitivity set increases by the factor of two  we will have two deltas, two gammas etc.
At the same time, for example, we can visualize the impact of a certain parameter  such as correlation on the call option premium computed above:
As seen from the chart, the option premium will increase when the correlation gets lower and will gradually decrease as the correlation increases  as expected. The curvature on the graph also reveals that the relationship between the premium and the correlation is nonlinear.