Expected errors in linear regression

Problem

We have a training set of examples and test set of examples both sampled randomly from the same distribution. Let be the parameters which minimize the sum of squared errors on the training set.

Prove that

\begin{align} \mathbb{E} \left[ \frac{1}{N} \sum_{i=1}^N (\beta^T x_i - y_i)^2 \right] \le \mathbb{E} \left[ \frac{1}{M} \sum_{i=1}^M (\beta^T \tilde{x}_i - \tilde{y}_i)^2 \right] \end{align}

where the expectations are taken over the training and test samples.

Solution

show

This is exercise 2.9 in Elements of Statistical Learning.