The Mean Variance (MV) assumption is the most commonly used function in portfolio optimization. The results of mean-variance analysis hold when (a) investors have quadratic utility functions or (b) returns are normally distributed.
The optimization is typically structured in the following manner:
Let,
N is the number of assets in the investment universe.
w = portfolio weight vector.
m = expected return vector.
D = covariance matrix of dimension N 2.
The mean of a portfolio with weights w i , where i=1 to N is:

(where T is the transpose), and the variance is:

The portfolio is mean-variant efficient for a given level of portfolio expected return l m (where l is a constant) if it satisfies the following conditions:
minimize the variance 
subject to the constraint 
Frequently, the portfolio weights are normalized so that they sum to unity and they are non-negative (no borrowing).
The typical method for optimization is to use “parametric quadratic programming”. This curve is generated by minimizing the following function for various values of l :

or, maximize:

|