Maximum Likelihood Estimators (Three independent normally distributed values with constraint) The context of the problem is trying to measure the angles between three constellations. 
Let $\theta_{1}, \theta_{2}, \theta_{3}$ denote the sizes of its three angles. The measurements of the angles $(X_{1}, X_{2}, X_{3})$ are imperfect. Assume they are independently distributed as $N(\theta_{i}, \sigma^2)$, for $i = 1, 2, 3$. Find the maximum likelihood estimators of $\theta_{1}, \theta_{2}, \theta_{3}$ based on his measurements, subject to the constraint $$\theta_{1} + \theta_{2} +  \theta_{3} = 180^{\circ}$$
I understand the general concept of maximum likelihood estimators, but I'm unsure how to work with three non-i.i.d distributions and the equality constraint.
Edit: Based on comments, I have come up with the gradient of the log likelihood function and constraint equation as shown below:
$$  \bigtriangledown  \ell =  \begin{bmatrix}(x_{1} - \theta_{1})/\sigma^2\\(x_{2} - \theta_{2})/\sigma^2 \\ (x_{3} - \theta_{3})/\sigma^2 \end{bmatrix} = \lambda\bigtriangledown  g =  \lambda\begin{bmatrix}1\\ 1\\ 1 \end{bmatrix} $$
Is this correct? How would I incorporate the constraints that all angles must be greater than 0? 
 A: If you have access to Mathematica, here is one approach:
(* Some measurments *)
{x1, x2, x3} = {12, 24, 146};

(* Log of the likelihood *)
logL = LogLikelihood[NormalDistribution[θ1, σ], {x1}] +
  LogLikelihood[NormalDistribution[θ2, σ], {x2}] +
  LogLikelihood[NormalDistribution[180 - θ1 - θ2, σ], {x3}]
(* -((-12+θ1)^2/(2 σ^2))-(-24+θ2)^2/(2 σ^2)-(-34+θ1+θ2)^2/(2 σ^2)+3/2 (-Log[2]-Log[π])-3 Log[σ] *)

(* Find values that maximize the likelihood subject to the restrictions *)
FindMaximum[{logL, {θ1 + θ2 < 180, θ1 > 0, θ2 > 0}}, {θ1, θ2, σ}]
(* {-3.04042, {θ1 -> 11.3333, θ2 -> 23.3333, σ -> 0.666667}} *)

Setting the partial derivatives of $\log L$ to zero and solving for $\theta_1$, $\theta_2$, and $\sigma$ gives one
$$\hat{\theta_1}=(180 + 2 x_1 - x_2 - x_3)/3$$
$$\hat{\theta_2}=(180 - x_1 + 2 x_2 - x_3)/3$$
$$\hat{\sigma} = |180 - x_1 - x_2 - x_3|/3$$
And $\hat{\theta_3}=180-\hat{\theta_1}-\hat{\theta_2}$ or $\hat{\theta_3}=(180-x_1-x_2+2x_3)/3$.  The estimators are weighted estimates of the observed angle and 180 minus the other two angles with weights 2/3 and 1/3, respectively.
Now if the restrictions are all satisfied, then you're done (other than estimating measures of precision).
The variance of $\hat{\theta_i}$ is ${2 \over 3}\sigma^2$ ($i=1,2,3$) and the estimate of the variance from a sample ($x_1, x_2, x_3$) is ${2 \over 27}(x_1+x_2+x_3-180)^2 $.  Note that if the sum of the measured angles is exactly 180, then the estimates of the variance will be zero.
