Minimizing expected loss in Regression with Rademacher random variables I am trying to prove the following equality. I am able to solve the terms inside the expectation but I am stuck because of the expectation with respect to $x,y$. I might be wrong in the whole process; could someone please help me?

Let $\beta\in\mathbb R^p$ and let $\mathbf x,y$ be random variables such that the entries of $\mathbf x$ are  $\mathbb P(\mathbf x_1 = 1)=\mathbb P(\mathbf x_1=-1)=\frac12$ and $y=\beta^T\mathbf x+\varepsilon$ where $\varepsilon\sim\mathcal N(0,1).$ 
$(a)$ Show that for any function $f:\mathbb R^p\to\mathbb R$ of the form $f(\mathbf u)=\mathbf u^T\alpha$ for all $\mathbf u\in\mathbb R^p$ we have
$$\mathbb E_{\mathbf x,y}[(f(\mathbf x)-y)^2] = 1 + \|\alpha-\beta\|_2^2.  $$ .

 A: This may be easier to see by expanding the matrix notation (which, through its inconsistent use of transposes, might be a little confusing):
$$f(\mathbf x) - y = x^\prime\alpha - (\beta^\prime \mathbf{x} + \varepsilon) = \sum_{i=1}^p (\alpha_i-\beta_i)x_i - \varepsilon.$$
Its square expands into three terms according to the power of $\varepsilon,$
$$(f(\mathbf{x})-y)^2 = \left(\sum_{i=1}^p (\alpha_i-\beta_i)x_i\right)^2 - 2\varepsilon\left(\sum_{i=1}^p (\alpha_i-\beta_i)x_i\right) + \varepsilon^2.$$
Assuming $\mathbf{x}$ is independent of $\varepsilon,$ you may take the expectation over $(\mathbf{x},y)$ by computing the expectations over $\mathbf{x}$ and $\varepsilon$ separately.
The expectations with respect to $\varepsilon$ are computed from the information in "$\varepsilon\sim\mathcal{N}(0,1):$" $E[\varepsilon]=0$ and $E[\varepsilon^2]=1-0^2 = 1.$
What is left to compute is the expectation of the first term, which you can expand to
$$\left(\sum_{i=1}^p (\alpha_i-\beta_i)x_i\right)^2  = \sum_{i=1}^p(\alpha_i-\beta_i)^2\,x_i^2 + 2\sum_{1\le i \lt j \le p}(\alpha_i-\beta_i)(\alpha_j-\beta_j)\,x_i\,x_j.$$
Very simple calculations based on the definition of expectation establish that $E[x_i]=0$ and $E[x_i^2]=1.$ You're done.
