I'm looking over a maximum likelihood problem right now and am having trouble following the calculus in the problem. To most here I'm sure it is very simple, and if someone could answer my questions I would appreciate it greatly.

The Problem: Consider a normall distributed random variable X with mean u and variance o^2, i.e., X~N(u,o^2). We observe a random sample {x1, x2, ...., xn}. Find the MLE of u. ( I will use r in place of pie, and E for epsilon)

(I will ask all of the questions that I have in CAPS)

Log of the density function:

logf(x) = -(1/2)*log(2ro^2) - (1/2)((x-u)/o)^2

When substituted into the likelihood function we get:

L = E[-(1/2)*log(2ro^2) - (1/2)((x-u)/o)]^2

which equals => -(n/2)*log(2ro^2) - (1/2o^2) E(x-u)^2

MY FIRST QUESTION, WHERE DOES THE n COME FROM, AND WHY IS EVERYTHING BESIDES THE (x-u) TAKEN OUT OF THE E?

Next we differentiate with respect to u and o^2:

dL/du = -(1/2o^2) E 2(x-u)(-1)

dL/d(o^2) = -(n/2)(1/o^2) + (1/2o^4)E(x-u)^2

Ok, in the (dL/du)... the first half of the likelihood function drops out because there isn't a "u" in it. I guess my only question is where does the (-1) come from? I think that it has something to do with the chain rule, but I'm really not sure.

In the second part, I understand the second part ((1/2o^4)E(x-u)^2), but am confused on how the first half is derived.

I really am behind in even this simple calculus, and if anyone could recommend somewhere would I could get some practice, I would greatly appreciate it. Thanks in advance!