Look at the
CAPM for the financial content, and
mean-variance optimisation for the maths. It's basically minimising a quadratic function, but in many dimensions, with two constraints - the
efficient frontier. You use Lagrange multipliers and arrive at a neat linear system.
Lots of fun parabolas and hyperbolas :-)