How to understand heteroscedasticity/homoscedasticity in Matrix form?

I understand the verbal meaning and graphical interpretation of homoscedasticity is that the variance of error term is same for any value of x, or in other words, the data points spread evenly between the regression line for any value of x. The non-matrix form is $\newcommand{\Var}{{\rm Var}}\Var(Ui|xi)=\theta^2$, for which, I can also understand.

But, I don't understand its Matrix expression: $\Var(U|X)=\theta^2I$. Especially expanding $\Var(U|X)$, we have
$$\Var(U|X)=E\begin{bmatrix}u1^2 &u1*u2 &...\\ u2*u1 &u2*u2 &...\\....\end{bmatrix}$$ I don't know whether the $u1, u2, ...$ here are error terms or residuals, and whether they are treat as random vectors or fixed values. If they are error terms, how can we test homoscedasticity (given they are unobservables. We test homoscedasticity on residuals right? based on the scatterplot of data points and regression line)? If they are residuals, $u1, u2, ...$ should be a fixed variable right? How come we can talk about expectations and variances?

• If the $u_i$ are the residuals and you verify that $Var(U|X) = \theta^2I$ then that means that your residuals is an identity matrix scaled by $\theta^2$. Thus all off-diagonal terms are null (independence of the residuals between observations) and the diagonal terms are $\theta^2$ (all residuals follow the same distribution of variance $\theta^2$) – Riff Oct 26 '16 at 13:07
• Homoscedasticy is simply an assumption here !. – Subhash C. Davar Oct 26 '16 at 13:27
• At the risk of over clarifying, heteroscedasticity occurs when the diagonal terms of the variance-covariance matrix are not constant, and thus $Var(U|X) \ne \theta^2I$. So not all the diagonal entries are $\theta^2$. – paqmo Oct 26 '16 at 15:10