# Difference between constraining pre and post optimization

What's the implication of constraining the optimized portfolio weights obtained using no constraints vs obtaining the weights with the constraints in the objective?

Let the asset returns be distributed with mean $\mu$ and covariance $C$.

$$r\sim(\mu,C)$$

Unconstrained portfolio optimization:

$$\min_w\frac{\gamma}{2}w^TCw-w^T\mu$$

Optimal weights-

$$w^*=\frac{1}{\gamma}C^{-1}\mu$$

Constraining post optimization-

Define $e$ as a vector of 1s.

$$e^Tw^*=1\implies\gamma=e^TC^{-1}\mu$$

$$w^*=\frac{C^{-1}\mu}{e^TC^{-1}\mu}$$

Constrained portfolio optimization:

$$\min_w\frac{\gamma}{2}w^TCw-w^T\mu-\lambda(e^Tw-1)$$

Optimal weights-

$$w^*=\frac{C^{-1}(\mu+\lambda e)}{e^TC^{-1}(\mu+\lambda e)}$$

$$f(x,y) = x^2 + y^2$$
The unconstrained minimisation is $x=y=0$. If you now constrain this sum to be equal to one, post optimisation, well it doesn't quite work since you multiply by infinity. But, even if the obj func was slightly different and it was finite it wouldn't return the minimum of the actual constrained minimisation which in this case is $x=y=0.5$, because they are two different calculations.