Mean as the Minimizer of Squared Loss
You have a set of data points $x_1, x_2, \ldots, x_n \in \mathbb{R}$. You want to find the single number $y$ that is closest to all of them in the least-squares sense.
Find $\arg\min_{y \in \mathbb{R}} \sum_{i=1}^{n} (x_i - y)^2$.
Then: what changes if you use absolute value instead of squared differences?
Open the full interactive solver, hints, and worked solution →