# MAP Estimator given exponent of the posterior distribution

I came across this problem while reading about MAP estimators (Trajectory estimation), but don't understand how the MAP estimate is calculated given the exponent of the posterior distribution.

Why does the minimization of

$$-\frac {1}{2}(\theta_1^2 + \frac{1}{\sigma^2} \sum_{i = 1}^{n} (y_i-\theta_0-\theta_1t_i-\theta_2t_i^2)^2)$$

work out to be $$\hat{\theta_1} = \frac{\sum_{i = 1}^{n}t_i(y_i-\theta_0-\theta_1t_i-\theta_2t_i^2)}{\sigma^2 + \sum_{i = 1}^{n}t_i^2}$$

I came across the following formula in a text book that I think might be related, but I'm not sure what I'm missing. Shouldn't the 1/sigma squared terms cancel?

$$\hat{\theta} = \frac{\sum_{i = 1}^{n} \frac {x_i}{\sigma_i^2}}{\sum_{i = 1}^{n} \frac {1}{\sigma_i^2}}$$

If anyone could explain this to me, that would be greatly appreciated. I'm in over my head trying to learn about this stuff on my own, but trying to figure it out. Thank you.