Consider the probability density function $$f(x)=\frac{1}{\theta^2}xe^{-x/\theta},\;\;\;\;\; 0\le x\lt\infty,\;\;0\lt\theta\lt\infty$$ Find the maximum likelihood estimator for $\theta$.
I'm really struggling with this question. From my understanding in order to find the maximum likelihood estimator for $\theta$, the function needs to be partially differentiated with respect to $\theta$, equated to zero, and solved for $\theta$; however for this question the differentiation is very messy and even more difficult, is solving the derivative for $\theta$.
If we have $ n $ sample size, then likelihood is $ L(x,\theta)= \prod f(x_i) $ So $ L(x,\theta)= (1/\theta^{2n})\prod x_i e^{-\sum x_i/\theta} $ Since $ 0<\theta <\infty $. We can use likelood as $ log L $. So $ log L = -2nlog\theta + \sum logx_i -\sum x_i /\theta $ differentiate with respect to $\theta$ and equate with $ 0$ we get $\theta_0 = \sum x_i/2n $. $ \frac {\partial log L}{\partial \theta}= -2n/\theta + \sum x_i /\theta^2 = 0 $ . So estimate $\theta_0 = \sum x_i/2n $. Now we check it maximises our likelihood. $ \frac {\partial^2 logL}{\partial \theta^2} = +2n/\theta^2 - 2\sum x_i/\theta^3 $. Put $ \theta = \sum x_i/2n $ we have $ \frac {\partial^2 logL}{\partial \theta^2} = 8 n^3/ (\sum x_i)^2 -16 n^3/ (\sum x_i)^2 $ which is negative. So $ \theta = \sum x_i/2n $ is maximum likelihood estimates.