Suppose you have $n$ i.i.d random variables $X_1,\dots,X_n$ that are normally distributed with mean $\mu$ and variance $\sigma^2$. Thus,
$$ f_{X_i} (\mu , \sigma^2) = \left( \frac{1}{\sigma \sqrt{2\pi}} \right) e^{\frac{-(x_i - \mu)^2}{2\sigma^2}} $$
Find the likelihood function of the joint density and the maximum likelihood estimate for $\mu$ and variance $\sigma^2$.
I found the Likelihood function to be
$$ L(x) = \prod_{i=1}^n \left( \frac{1}{\sigma \sqrt{2\pi}} \right)^n e^{\frac{-\sum_{i=1}^n (x_i - \mu)^2}{2\sigma^2}} $$
Taking the natural log of both sides then yielded
$$ \ln{L(x)} = \sum_{i=1}^n (-n\ln{\sigma \sqrt{2\pi}} - \frac{\sum(x_i - \mu)^2}{2\sigma^2})$$
$$\frac{\mathrm{d}}{\mathrm{d}\mu}\ln{L(x)} = \sum \sum (x_i - \mu) = 0 $$
Ideally, we are supposed to show that $\mu = \frac{\sum x_i}{n} $
Can someone help me see where I went wrong?
$\log f = c - \frac{(x-\mu)^2}{2\sigma^2}$ so $\frac{d}{d\mu} \log f = \frac{x-\mu}{\sigma^2}$ and $\frac{d}{d\mu} \log L \propto \sum x_i-\mu = 0.$ This gives $\hat{\mu} = \frac{1}{n}\sum x_i$.
The joint density of independent variables is their product so the log likelihood is $\log L = \log \prod f(x_i) = \sum \log f(x_i)$. It is fine to maximize log instead of likelihood since $f$ is strictly increasing.