Finding MLE, MOM of a distribution I'm stuck on a particular problem and I'm not quite sure what to do. The problem reads as such:

Let $X_1, X_2, . . . , X_n$ be a random sample from a distribution
  with density $f(x) = \frac{xe^\frac{-x}{\beta}}{\beta^2}$
  where $x > 0, b 
> 0.$ Find the MLE and the MOM of $\beta.$

I want to say that the MLE of $\beta$ is just the derivative of $f(x)$ with respect to $\beta$ but I'm not sure. And I'm drawing a blank on the MOM. Any help would be appreciated!
 A: The maximum likelihood function is given by $$\mathcal L(\vec{x},β)=\prod_{i=1}^{n}f(x_i\midβ)=\prod_{i=1}^{n}\frac{1}{β^2}x_ie^{-\frac{1}{β}x_i}=β^{-2n}e^{-\frac{1}{β}\sum_{i=1}^{n}x_i}\cdot \prod_{i=1}^{n}x_i$$ The log-likelihood function is given by $$\mathcal l(\vec{x},β)=\ln\left(\mathcal L(\vec{x},β)\right)=-2n\ln(β)-\frac{1}{β^2}\sum_{i=1}^{n}x_i+\sum_{i=1}^{n}\ln(x_i)$$ Setting the derivative of $\mathcal l$ with respect to $β$ equal to $0$ yields $$\frac{\partial}{\partial β}\mathcal l(\vec{x},β)=\frac{-2n}{β}+2\frac{1}{β^3}\sum_{i=1}^{n}x_i\overset{!}=0\implies\hat{β}
=\sqrt{\frac{\sum_{i=1}^{n}x_i}{n}}$$ which satisfies $\hat{β}>0$ as required. Checking also the second derivative you obtain that in the given $\hat{β}$ the log-likelihood attains indeed a maximum.
To find the MOM you need to calculate the expected value $μ=Ε[X]$ of the distribution and set it equal to the sample mean $\bar{X}_n$ (Someone gets easily confused that $\bar{X}_n$ is also unknown. No, it is known since it depends on the measurement of the random variables $X_i$ and as soon as you conduct your experiment - measurements/sampling - you will have concrete numerical values to substitute in their place.). So $$μ=Ε[X]=\int_{0}^{\infty}xf(x)dx=\int_{0}^{\infty}\frac{x^2}{β^2}e^{-\frac{x}{β}}dx=β\int_{0}^{\infty}u^2e^{-u}du=2β$$ Thus the mom of $β$ is given by $$μ=\bar{X}_n\iff\tilde{β}=\frac{\bar{X}_n}{2}$$
