Is the mean variance optimization the same thing as the capital asset pricing model? Or is the mean variance only a part of CAPM?
Mean-Variance Optimization is a generic framework that creates optimal portfolios relative to two measures of risk - mean and standard deviation (covariation). It holds in general for elliptical distributions where the scale and location of the distribution are the only sources of risk and return. For a Normal Distribution this is $(\mu, \Sigma)$.
CAPM is a strict set of equilibrium assumptions made on the mean-variance framework to obtain certain results for the behaviour of the representative agent in the market. Namely, that is all agents were rational, with concave quadratic utility functions dependent on the first two moments, then the market portfolio would be the optimal portfolio and all other returns could be determined by their "$\beta$" to the market. The key idea behind this is that all risk and return originates from a single factor, the market. So risk can be decomposed into two components, the systematic and the idiosyncratic. But, diversification (ala Mean Variance) can remove the idiosyncratic risk, so no rational agent should price it. As a result, all expected returns are given by the beta (covariation, regression coefficient) to the market.
Mean variance and CAPM are not the same thing.
Neither the mean-variance model are the part of the CAPM. Rather the CAPM, in certain sense, is an part of the mean variance model.
To put it better, if we have $N$ risky assets plus a riskless one then we can achieve the a la CAPM representation. Moreover if the tangency ptf overlap the market ptf, as the CAPM assumption impose (equilibrium), we have the standard CAPM.
In other way, if the mean variance model do not hold neither the CAPM hold. Instead if the CAPM not hold the mean variance can hold still. The mean variance is more general.