Finding the Maximum Likelihood Estimator of a Median

Let $X1, \dots, Xn$ be a random sample of size n from the continuous distribution with pdf $f_X(x|\theta) = \frac{e^{-x}}{1-e^{-\theta}} I(x)_{[0,\theta]} I(\theta)_{(0, \infty)}$.

(1) Find the maximum likelihood estimator for $\theta$.

(2) Find the maximum likelihood estimator for the median,$\lambda$, of this distribution.

For (1), I got $X_{(n)}$ because I thought if $\theta$ was minimized, it would maximize the function.

For (2), I know I set up the distribution to solve for the value of the median. I think that once I find this value I will use it in relation to the MLE from (1) to find the MLE for(2). I got $m = ln(2) - ln(e^{-\theta} + 1)$ but this doesn't seem right and I amd not sure where I am messing up. Any assistance is greatly appreciated.

-

Consider $s_n=x_1+\cdots+x_n$ and $t_n=\max\{x_k\mid1\leqslant k\leqslant n\}$, then $$f(x_1,\ldots,x_n\mid\theta)=\mathrm e^{-s_n}(1-\mathrm e^{-\theta})^{-n}\mathbf 1(\theta\geqslant t_n).$$ Since $2\mathrm e^{-\lambda}=1+\mathrm e^{-\theta}$, this is also $$f(x_1,\ldots,x_n\mid\theta)=\mathrm e^{-s_n}2^{-n}(1-\mathrm e^{-\lambda})^{-n}\mathbf 1(\lambda\geqslant\log2-\log(1+\mathrm e^{-t_n})).$$ Thus, $f(x_1,\ldots,x_n\mid\theta)$ is indeed maximum when $\lambda=\hat\lambda$, with $$\hat\lambda=\log2-\log(1+\mathrm e^{-t_n}).$$ Note that $\hat\lambda=g(\hat\theta)$ where the function $g$ is defined by $\lambda=g(\theta)$.