Derivation (minimal sufficient statistic for the normal location problem)

Compute $$ \begin{align*} \frac{p(x; μ, σ^2)}{p(y; μ,σ^2)} ={}& \frac{\frac{1}{(2πσ^2)^{n/2}} \exp\left(-\frac{1}{2σ^2} \sum_{i=1}^{n} (x_i - μ)^2\right)}{\frac{1}{(2πσ^2)^{n/2}} \exp\left(-\frac{1}{2σ^2} \sum_{i=1}^{n} (y_i - μ)^2\right)} \\ ={}& \exp\left(-\frac{1}{2σ^2}\left(\sum_{i=1}^{n} x_i^2 - \sum_{i=1}^{n} y_i^2\right) - \frac{μ}{σ^2}\left(\sum_{i=1}^{n} x_i - \sum_{i=1}^{n} y_i\right)\right). \end{align*} $$

If $σ^2$ is known, $p(x;μ)/p(y;μ)$ does not depend on $μ$ iff $\sum_{i} x_i = \sum_{i} y_i$, so $\sum_{i} X_i$ is a minimal sufficient statistic.

If both $μ$ and $σ^2$ are unknown, then the ratio depend on neither $μ$ nor $σ^2$ iff $\sum_{i} x_i = \sum_{i} y_i$ and $\sum_{i} x_i^2 = \sum_{i} y_i^2$, so $(\sum_{i} X_i, \sum_{i} X_i^2)$ is a minimal sufficient statistic.