Integrating Normal Distribution with $1$, $x$, and $x^2$ I am taking an introductory Machine Learning class but it has been a while since I took calculus. I am having a difficulty in understanding the following equations.
So we are currently talking about the Gaussian Distribution:
$$\int_{-\infty}^{\infty} N(x|\mu,\sigma^2)dx = 1$$
This makes sense to me as I understand that the sum of the probability distribution adds up to one.
Where I start to struggle is the following:
$$\int_{-\infty}^{\infty} N(x|\mu,\sigma^2)xdx = \mu$$
I dont understand how adding all the x values from $-\infty$ to $\infty$ gives us the mean. 
And this is the next step in the equations, which once again, I cant follow but I believe If I can get the earlier one, this one will be easy as well.
$$\int_{-\infty}^{\infty} N(x|\mu,\sigma^2)x^2dx = \mu^2 + \sigma^2$$
Sorry for the trivial looking question. If I can wrap around the intuitive meanings the rest should be easier I feel. The content is from Pattern Recognition and Machine Learning.
Thank you
 A: just write it out:
$$
\int_{-\infty}^{\infty} N(x|\mu,\sigma^2)dx = \int_{-\infty}^{\infty} \dfrac {1}{\sqrt {2\pi} \sigma} e^{- \frac {(x-\mu)^2}{2\sigma^2}}dx=1
$$
and
$$
\int_{-\infty}^{\infty} N(x|\mu,\sigma^2)xdx =\int_{-\infty}^{\infty} \dfrac {1}{\sqrt {2\pi} \sigma} e^{- \frac {(x-\mu)^2}{2\sigma^2}}xdx
$$
change variables $z=\dfrac {x-\mu}{\sigma}$, we get
$$
=\int_{-\infty}^{\infty} \dfrac {1}{\sqrt {2\pi}} e^{- \frac {z^2}{2}}(\sigma z + \mu )dz=\sigma\int_{-\infty}^{\infty} \dfrac {1}{\sqrt {2\pi}} e^{- \frac {z^2}{2}} zdz+\mu\int_{-\infty}^{\infty} \dfrac {1}{\sqrt {2\pi}} e^{- \frac {z^2}{2}} dz
$$
the first integral in the right hand side is zero since the integrand is odd; the second is $\mu\int_{-\infty}^{\infty} N(x|0,1)dx=\mu$. Then we are done.
You can do the next case on your own.
A: In you second equation it is important to notice that you are weighting $x$ by the probability of getting $x$, so the most likely values are going to contribute more to the sum, than the less likely values. That's why 
$$
\int_{-\infty}^{+\infty}{\rm d}x~xN(x|\mu,\sigma^2) = \mu
$$
All this is saying is that average value of $x$ is $\mu$.
As for the last equation, you're ultimately calculating the integral
$$
\int_{-\infty}^{+\infty}{\rm d}x~(x-\mu)^2N(x|\mu,\sigma^2) 
$$
which just represents the average (squared) distance from the all points to the mean value $\mu$
