# Proof for maximum likelihood estimation for Poisson distribution

I am trying to do this exercise which says

Given two independent random variables $$X$$ and $$Y$$ with the distribution $$X\sim Po(\theta)$$ and $$Y\sim Po(2\theta)$$, and the observations $$x=2$$ and $$y=7$$, show that the expression of the log-likelihood function is given by

\begin{align*} & l(\theta)=[7ln(2) - ln(2!) - ln(7!)] + 9ln(\theta) - 3\theta\\ \end{align*}

My solution looks like this:

Probability density function (PDF) for Poisson distribution: \begin{align*} & P(X=x)=\frac{\theta^x * e^{-\theta}}{x!} \\ \end{align*}

Likelihood function is the product ($$\prod$$) of PFD: \begin{align*} & l(\theta)=L(\theta;x_1,...,x_n) = \prod_{j=1}^n(\frac{\theta^{x_j} * e^{-\theta}}{x_j!})\\ \end{align*}

Re-write it to natural logarithm: \begin{align*} & l(\theta) = \sum_{j=1}^nln\bigl(\frac{\theta^{x_j} * e^{-\theta}}{x_j!}\bigr) \\ & l(\theta) = \bigl(\sum_{j=1}^n x_j\bigr)*\bigl(ln(\theta)) - n\theta - \bigl(\sum_{j=1}^nln(x_j)\bigr) \\ \end{align*}

Calculate the derivative with regards to $$\theta$$: \begin{align*} & \frac{d}{d\theta}\bigl( l(\theta)\bigr) = \frac{d}{d\theta}\bigl(\sum_{j=1}^n x_j*ln(\theta) - n\theta - \sum_{j=1}^nln(x_j)\bigr) = -n+(\frac{1}{\theta})(\sum_{j=1}^nx_j) \end{align*}

Put equal to zero and solve for $$\theta$$: \begin{align*} &-n+(\frac{1}{\theta})(\sum_{j=1}^nx_j)=0 \Rightarrow \theta=\frac{(\sum_j^nx_j)}{n} = \bar{x} \end{align*}

I followed this article, but im not sure on how to proceed. How do I get the given equation? What am I doing wrong here?

What you are missing is that the question is asking for the log-likelihood for two observations, one from $$X$$ and one from $$Y$$. What you did was calculate the MLE for a sample of $$n$$ IID observations. I don't know why you did that when the question was very clear.
You observed $$X = 2$$ from $$X \sim \operatorname{Poisson}(\theta)$$ and $$Y = 7$$ from $$Y \sim \operatorname{Poisson}(2\theta)$$. So the joint probability of this outcome is $$\Pr[(X,Y) = (2,7)] \overset{\text{ind}}{=} \Pr[X = 2]\Pr[Y = 7] = e^{-\theta} \frac{\theta^2}{2!} e^{-2\theta} \frac{(2\theta)^7}{7!}.$$ And this is proportional to your likelihood for $$\theta$$; i.e., $$\mathcal L(\theta \mid X = 2, Y = 7) \propto \Pr[(X,Y) = (2,7)].$$