# Is there an algebra error in this derivation in a Coursera class of the posterior of a Normal with a Student-distributed mean?

This is a screenshot from Coursera's class "Bayesian Statistics: Techniques and Models", Week 1, "Non-conjugate models" lecture (any one can audit the class and access the materials for free):

This is a repeat class, so there have been lots of eyeballs on it, and therefore I assume it is correct. However, the exponent in the last-but-one line is quadratic in $$y$$, while in the last one it is linear in $$y$$. How can this be correct? Did they just make an undetected mistake here or am I missing something really basic?

• I guess the process here is dropping any element that is not a function of the model parameter $\mu$ – yoav_aaa Aug 12 '19 at 8:27

Note that he is calculating $$P(\mu | y_1,y_2...)$$. Thus the realisations $$y_i$$ are constant. Therefore, $$C := -\frac{1}{2}\sum_{i=1}^n y_i^2$$ is also constant and we get: $$P(\mu | y_1,y_2...) \propto\frac{1}{1+\mu^2} \text{exp}\left(C+n\left(\bar y\mu-\frac{\mu^2}{2} \right)\right)$$ $$=\frac{1}{1+\mu^2} \text{exp}(C)\cdot \text{exp}\left(n\left(\bar y\mu-\frac{\mu^2}{2} \right)\right)\propto \frac{1}{1+\mu^2} \text{exp}\left(n\left(\bar y\mu-\frac{\mu^2}{2} \right)\right)$$