For a random variable $X$ on a probability space $(\Omega,F,P)$ we have it's mean $E[X]$ given by $E[X] = \int_{\Omega} X dP$.
If the random variable has a density function given by the multivariate normal distribution with mean $\mu \in \mathbb{R}^n$ and covariance $Q$ (symbolically $N(\mu,Q)$) how do I transform $E[X] = \int_{\Omega} X dP$ into $\int_{\mathbb{R}^n} xN(\mu,Q)dx$ ?
The$\newcommand{\II}{1}\newcommand{\RR}{\mathbb{R}}\newcommand{\FF}{\mathcal{F}}$ way I've gone about answering your question involves a bit of a dive into the elementary mechanics of measure theory. Let me preface by giving some intuition. We have the standard way of integrating on $\RR^n$ — namely, with respect to Lebesgue measure $\lambda$. Given that we can integrate all sorts of functions this way, can we develop alternative notions of "integral" on $\RR^n$ using Lebesgue measure as a foundation? In particular, we would like our new integrals to correspond to familiar notions of probability. So what we're really after is a way of integrating with respect to different probability distributions based on Lebesgue measure.
Let's see if we can now flesh this out more technically. Note: Please let me know if there are any parts of this discussion you would like me to clarify, and I'll be happy to explain more.
Measure-theoretic context
Let $(\Omega, \FF, \lambda)$ be a measure space. We present a general technique for generating new probability measures.
Constructing the measure
Let $f : \Omega \to \RR$ be nonnegative (almost surely) such that $$ \int_\Omega f \ d\lambda = 1. $$ Define the set function $P : \FF \to \RR$ by $$ P(E) = \int_\Omega \II_E \cdot f \ d\lambda = \int_E f \ d\lambda, $$ where $\II_E$ is the indicator function of $E$. Now, since $f$ is nonnegative a.s. it follows that $P(E) \geq 0$ for any $E \in \FF$. Moreover, it is not hard to see that $P$ is, in fact, a probability measure:
Integration with respect to the measure
Now, we can apply the "standard machine" argument to show that $\int_{\Omega} g \ d P = \int_{\Omega} g \cdot f \ d\lambda$ for any measurable function $g : \Omega \to \RR$.
Back to the original question
In our case, we are in $\Omega = \RR^n$. We want to construct the probability measure $P$ corresponding to the multivariate normal distribution $N(\mu, Q)$. I tried to be sneaky in the previous section by hinting at how to proceed. If $\lambda$ is Lebesgue measure on $\RR^n$, and we define $f : \RR^n \to \RR$ by $$ f(x) = \frac{1}{\sqrt{(2\pi)^n \det Q}} \exp\left(-\frac{1}{2} (x - \mu)^T Q^{-1} (x-\mu)\right), $$ then we have
and thus there exists a probability measure $P$ on $\RR^n$ such that $$ P(E) = \int_{\RR^n} \II_E \cdot f \ d\lambda = \int_E f(x) \ dx $$ where the right hand side is justified by $f$ being continuous and thus reducing to the familiar Riemann integral.
But of course, $f$ was chosen in a special way to correspond to the multivariate normal random variable $X \sim N(\mu, Q)$. It follows, at last, that \begin{align} E[X] &= \int_{\RR^n} x \ dP \\ &= \int_{\RR^n} x \cdot f \ d\lambda \\ &= \int_{\RR^n} x \cdot f(x) \ dx. \end{align}