Proof of Variance of the Irreducible Error In Introduction to Statistical Learning, given the general form of a quantitative response between a set of predictor variables and a target variable
$$Y=f(X)+\epsilon$$
and the general form for a prediction over the same predictors and target
$$\hat{Y}=\hat{f}(X)$$
the authors draw what is referred to as a simple conclusion with regard to the expected value of the squared difference between the predicted and actual value of $Y$ and the variance associated with the error term, $\epsilon$, that is, given an estimate $\hat{f}$ and a set of predictors $X$,
\begin{align*}
\mathbb{E}\left[(Y-\hat Y)^2\right]
  &=\mathbb{E}\left[\left(f(X)+\epsilon-\hat{f}(X)\right)^2\right] \\
  &=\left[f(X)-\hat{f}(X)\right]^2 + \text{Var}(\epsilon)
\end{align*} 
I am having trouble completing this proof and am hoping for some assistance filling in the blanks. 
My work thus far: 
\begin{align*}
\mathbb{E}\left[(Y-\hat Y)^2\right]
  &=\mathbb{E}\left[\left(f(X)+\epsilon-\hat{f}(X)\right)^2\right] \\
  &=\mathbb{E}\left[\left(f(X)+\epsilon-\hat{f}(X)\right)
                    \left(f(X)+\epsilon-\hat{f}(X)\right)\right] \\
  &=\mathbb{E}\left[\left(f(X)-\hat{f}(X)\right)
                    \left(f(X)+\epsilon-\hat{f}(X)\right)
                   +\epsilon
                    \left(f(X)+\epsilon-\hat{f}(X)\right)\right] \\
  &=\mathbb{E}\left[\left(f(X)-\hat{f}(X)\right)^2
                    +\epsilon
                     \left(f(X)-\hat{f}(X)\right)
                   +\epsilon
                    \left(f(X)-\hat{f}(X)\right)
                   +\epsilon^2\right] \\
\text{Because the expectation is linear}&\\
  &=\mathbb{E}\left[\left(f(X)-\hat{f}(X)\right)^2\right]
   +\mathbb{E}\left[\epsilon^2+
                   2\epsilon
                     \left(f(X)-\hat{f}(X)\right)\right] \\
\text{Because $f$ and $\hat{f}$ are constant}&\\
  &=\left[f(X)-\hat{f}(X)\right]^2
   +\mathbb{E}\left[\epsilon^2+
                   2\epsilon
                     \left(f(X)-\hat{f}(X)\right)\right] \\
\end{align*} 
And this is as far as I get. According to the final result
$$\text{Var}(\epsilon)=\mathbb{E}\left[\epsilon^2+
                   2\epsilon
                     \left(f(X)-\hat{f}(X)\right)\right]$$
but I can not see how to make this work. 
 A: The proof can be greatly simplified if we consider that for a random variable $W$ and a constant $c$, $$\operatorname{E}[(W+c)^2] = \operatorname{E}[W^2 + 2cW + c^2] = \operatorname{E}[W^2] + 2c \operatorname{E}[W] + c^2.$$  Consequently, if $\operatorname{E}[W] = 0$, then $$\operatorname{E}[W^2] = \operatorname{Var}[W],$$ hence $$\operatorname{E}[(W+c)^2] = \operatorname{Var}[W] + c^2.$$  Then with the choice $W = \epsilon$, $c = f(X) - \hat f(X)$, the result follows.

Alternatively, we can consider the transformed variable $U = W + c$, which clearly satisfies $$\operatorname{Var}[U] = \operatorname{Var}[W].$$  Thus $$\operatorname{E}[U^2] = \operatorname{Var}[U] + \operatorname{E}[U]^2 = \operatorname{Var}[W] + (\operatorname{E}[W] + c)^2,$$ and again, if $\operatorname{E}[W] = 0$, we obtain the identity $$\operatorname{E}[(W+c)^2] = \operatorname{Var}[W] + c^2.$$
A: Asked here. Not answered but comments point at two facts that lead me to the following solution.
In comments:


*

*Because the mean of $\epsilon$ is zero

*Because the variance of $\epsilon$ is $\mathbb{E}(\epsilon^2)$


Completed Proof:
\begin{align*}
\mathbb{E}\left[(Y-\hat Y)^2\right]
  &=\mathbb{E}\left[\left(f(X)+\epsilon-\hat{f}(X)\right)^2\right] \\
  &=\mathbb{E}\left[\left(f(X)+\epsilon-\hat{f}(X)\right)
                    \left(f(X)+\epsilon-\hat{f}(X)\right)\right] \\
  &=\mathbb{E}\left[\left(f(X)-\hat{f}(X)\right)
                    \left(f(X)+\epsilon-\hat{f}(X)\right)
                   +\epsilon
                    \left(f(X)+\epsilon-\hat{f}(X)\right)\right] \\
  &=\mathbb{E}\left[\left(f(X)-\hat{f}(X)\right)^2
                    +\epsilon
                     \left(f(X)-\hat{f}(X)\right)
                   +\epsilon
                    \left(f(X)-\hat{f}(X)\right)
                   +\epsilon^2\right] \\
\text{Because the expectation is linear}&\\
  &=\mathbb{E}\left[\left(f(X)-\hat{f}(X)\right)^2\right]
   +\mathbb{E}\left[\epsilon^2\right]
   +2\mathbb{E}\left[\epsilon
                     \left(f(X)-\hat{f}(X)\right)\right] \\
\text{Because $f$ and $\hat{f}$ are constant}&\\
  &=\left[f(X)-\hat{f}(X)\right]^2
   +\mathbb{E}\left[\epsilon^2\right]
   +2\mathbb{E}\left[\epsilon
                     \left(f(X)-\hat{f}(X)\right)\right] \\
\text{Because the mean of $\epsilon$ is zero}&\\
  &=\left[f(X)-\hat{f}(X)\right]^2
   +\mathbb{E}\left[\epsilon^2\right] \\
\text{Because the variance of $\epsilon$ is $\mathbb{E}(\epsilon^2)$}&\\
  &=\left[f(X)-\hat{f}(X)\right]^2 + \text{Var}(\epsilon)
\end{align*} 
A: This is merely a clarification of the proof by heropup:
Proposition: $E(Y - \hat{Y})^2 = [f(X) - \hat f(X)]^2 + Var(\epsilon)$
Proof:
By definition of $\epsilon$, its mean is $0$, so: 
$E(\epsilon) = 0$ ...1
Let c be some constant (specifically, $\epsilon$ is independent of c )
Then,
$(\epsilon + c)^2 = \epsilon^2 + 2.c.\epsilon + c^2$
Computing expected value:
$E[(\epsilon + c)^2] = E[\epsilon ^ 2 + 2.c. \epsilon + c^2]$ 
$E[(\epsilon + c)^2] = E[\epsilon ^ 2] + E[2.c. \epsilon] + E[c^2]$ 
$E[(\epsilon + c)^2] = E[\epsilon ^ 2] + 2.c.E[\epsilon] + E[c^2]$ ...2
Now, Variance of a random variable t, with mean $\mu$, is defined as:
$Var(t) = E[(t - \mu)^2]$
If the mean is $0$, this becomes:
$Var(t) = E[t^2]$
Taking $t = \epsilon$, for which the mean is $0$ (from (1)), we get: 
$Var(\epsilon) = E[\epsilon^2]$ ...3
Substituting for $E[\epsilon^2]$ from (3) in (2), and since $E[\epsilon] = 0$ from (1), we get:
$E[(\epsilon + c)^2] = Var(\epsilon) + E[c^2]$
Now, taking $c = f(X) - \hat f(X)$ (since $\epsilon$ is given to be independent of $X$), we get:
$E[(\epsilon + f(X) - \hat f(X))^2] = Var(\epsilon) + E[(f(X) - \hat f(X))^2]$ ...4
But we also know that $Y=f(X)+\epsilon$ and $\hat Y = \hat f(X)$. So, substituting these into 4, we get:
$E[(Y - \hat Y)^2] = E[(f(X) - \hat f(X))^2] + Var(\epsilon)$ $\square$
