In the previous section, I promised to tell you exactly how I calculated the optimal portfolios. In this section, I will fulfill the promise and explain how to formally set the problem of choosing the optimal portfolio in the language of mathematics If you don't set any constraints on the optimization algorithm, it will tell you pretty quickly that a portfolio with minimal variance is a portfolio with zero weights. Indeed, if you do not invest anything, then there will be no risk at all