Normal maximum likelihood estimates

Let X_1,\ldots,X_n be independent and \operatorname{N}(\mu,\sigma^2), with both parameters unknown. Derive the maximum likelihood estimates of \mu and of \sigma^2.

Up to a constant,

\log L(\mu,\sigma^2)=-\frac1{2\sigma^2}\sum_{i=1}^n(x_i-\mu)^2-\frac n2\log\sigma^2.

Differentiating in \mu gives \sum_i(x_i-\mu)=0, so \widehat\mu=\overline x. Differentiating in \sigma^2 and substituting \overline x gives

\widehat\sigma^2=\frac1n\sum_{i=1}^n(x_i-\overline x)^2.

To check that this is a maximum, note that for fixed \sigma^2 the log-likelihood is a downward parabola in \mu, largest at \overline x whatever \sigma^2 is. With \mu=\overline x and v=\sigma^2, the profile -A/(2v)-\tfrac n2\log v with A=\sum(x_i-\overline x)^2 has derivative A/(2v^2)-n/(2v), positive for v<A/n and negative after. So (\overline x,\widehat\sigma^2) is the global maximum.