This paper by Robert Merton describes how to derive the efficient frontier equation. It is mostly straightforward except for equation 9, which I hope someone can help me with.
The idea is to combine equation 4 and 8 into equation 9. Here they are:

The first term of equation 9 looks wrong to me. Is it me or is it the paper?