MLE for Bernoulli parameter with constraint

We have $$X \sim \text{bernoulli} \left(p \right), p \geq0.50$$. Goal is to to estimate the MLE of $$p$$

With unconstraint case, I can calculate the MLE is the sample mean.

For constraint case, there is some discussion in Estimator when a coin is either fair or has two heads - however I cant fully understand this.

In particular, how can I derive this expression using the log-likelihood $$\theta^{\sum_{i=1}^n x_i} (1-\theta)^{n-\sum_{i=1}^n x_i}$$,

$$\hat{\theta}= \begin{cases} \frac{1}{2} &\text{if} &\sum_{i=1}^n X_i\ne n; \\ 1 &\text{if} &\sum_{i=1}^n X_i=n. \end{cases}$$

Let $$T=\sum_{1\leq i\leq n} X_i.$$

Log likelihood is

$$\mathcal L= T\ln \theta +(n-T) \ln(1-\theta).\tag 1\label 1$$

Differentiate $$\eqref 1$$ w.r.t. $$\theta$$ to get

$$\frac{\mathrm d\mathcal L}{\mathrm d\theta} =\frac{T}{\theta} -\frac{n-T}{1-\theta};$$ therefore $$\frac{\mathrm d\mathcal L}{\mathrm d\theta} = 0\implies \hat{\theta}_{\textrm{MLE}}=\frac{T}{n}.\tag 2\label 2$$ What happens to $$\hat{\theta}_{\textrm{MLE}}$$ in $$\eqref 2$$ if $$T=n?$$ What happens if it isn't? Given is $$\theta\in\{1/2, 1\}.$$

If $$\theta=1,$$ then $$T=n$$ for all realizations would be success. However, the moment one observes $$T\ne n,$$ one can readily conclude $$\theta \ne 1.$$ So, if latter is the case and you only can have $$\theta$$ among $$1/2$$ and $$1,$$ what would $$\hat{\theta}_{\textrm{MLE}}$$ be?

• It is trivial for $T=n$, which is 1, but still not clear the case of otherwise. Feb 2, 2023 at 9:28
• @BrianSmith try drawing the likelihood function and mark in the constraint. Feb 2, 2023 at 9:30
• @BrianSmith check the edited post. Feb 2, 2023 at 9:48