Once we have @ThorGirl's derivation for $\mathrm{SE}\left(\hat{\beta}_1\right)^2$ we can use that to derive the Standard Error for $\hat{\beta}_0$, i.e. $\mathrm{SE}\left(\hat{\beta}_0\right)^2 $.
Note: If you are looking for a step-by-step explanation of @ThorGirl's
answer take a look at this video.
We are going to use the following assumptions / observations:
- Each output $y_i$ is assumed to have the form: $\beta_0 + \beta_1 x_i + \epsilon_i$
- $\overline{y} = \frac{1}{n}\sum_{i=1}^{n} y_i$
- The error terms $\epsilon_i$ are uncorrelated with constant variance $\sigma^2$
- $y_i$, $\hat{\beta}_0$ and $\hat{\beta}_1$ are random variables.
- $x_i$ are known constants. $\beta_0$ and $\beta_1$ are the true values of the estimators, hence are also constants.
During the derivation we are going to use the following properties of variance. Here $a$ and $b$ are constants and $X$ and $Y$ are random variables.
- $\mathrm{Var}(aX+b) = a^2\mathrm{Var}(X)$
- $\mathrm{Var}(aX+bY) = a^2\mathrm{Var}(X) + b^2\mathrm{Var}(y) + 2ab \mathrm{Cov}\left(X,\:Y\right)$
We start with the definition of $\hat{\beta}_0$ :
$$ \hat{\beta}_0 = \overline{y} - \hat{\beta}_1 \overline{x} $$
Therefore we have:
$$ \mathrm{Var}\left(\overline{y} - \hat{\beta}_1 \overline{x}\right) $$
At this point if $\overline{y}$ and $\hat{\beta}_1$ are uncorrelated we can take each term's variance. This uncorrelation is what @Flowsnake's answer refers to.
$$ \mathrm{Var}\left(\overline{y}\right) + \mathrm{Var}\left(-\hat{\beta}_1 \overline{x}\right) $$
As the predictors (inputs) $x_i$ are generally assumed to be known we can treat $\overline{x}$ as a constant.
$$ \mathrm{Var}\left(\overline{y}\right) + \left(-\overline{x}\right)^2 \mathrm{Var}\left(\hat{\beta}_1\right) $$
Using @ThorGirl's answer, we can substitute $\mathrm{Var}\left(\hat{\beta}_1\right)$:
$$ \mathrm{Var}\left(\overline{y}\right) + \overline{x}^2 \frac{\sigma^2}{\sum_{i=1}^n \left(x_i-\overline{x}\right)^2} $$
The following steps will focus on $\mathrm{Var}\left(\overline{y}\right)$. As $y_i$ is not a constant, we must make a few substitutions.
$$ \mathrm{Var}\left(\frac{1}{n} \sum_{i=1}^ny_i\right) + \overline{x}^2 \frac{\sigma^2}{\sum_{i=1}^n \left(x_i-\overline{x}\right)^2} $$
By definition of the statistical model, we can further expand the term.
$$ \mathrm{Var}\left(\frac{1}{n} \sum_{i=1}^n\left(\beta_0 + \beta_1x_i + \epsilon_i\right)\right) + \overline{x}^2 \frac{\sigma^2}{\sum_{i=1}^n \left(x_i-\overline{x}\right)^2} $$
$$ \frac{1}{n^2}\mathrm{Var}\left(\sum_{i=1}^n\left(\beta_0 + \beta_1x_i + \epsilon_i\right)\right) + \overline{x}^2 \frac{\sigma^2}{\sum_{i=1}^n \left(x_i-\overline{x}\right)^2} $$
As $\epsilon_i$ is uncorrelated, the variance of the sum of random variables becomes a sum of individual variances.
$$ \frac{1}{n^2}\sum_{i=1}^n\mathrm{Var}\left(\beta_0 + \beta_1x_i + \epsilon_i\right) + \overline{x}^2 \frac{\sigma^2}{\sum_{i=1}^n \left(x_i-\overline{x}\right)^2} $$
$$ \frac{1}{n^2}\sum_{i=1}^n\mathrm{Var}\left(\epsilon_i\right) + \overline{x}^2 \frac{\sigma^2}{\sum_{i=1}^n \left(x_i-\overline{x}\right)^2} $$
$$ \frac{1}{n^2}\sum_{i=1}^n\sigma^2 + \overline{x}^2 \frac{\sigma^2}{\sum_{i=1}^n \left(x_i-\overline{x}\right)^2} $$
$$ \frac{1}{n}\sigma^2 + \overline{x}^2 \frac{\sigma^2}{\sum_{i=1}^n \left(x_i-\overline{x}\right)^2} $$
$$ \sigma^2 \left[\frac{1}{n} + \frac{\overline{x}^2}{\sum_{i=1}^n\left(x_i - \overline{x}\right)^2}\right] $$