# Question about Regression error and the residual maker matrix

Starting with the 'residual maker' defined by M in: $$e= y-\hat{y} = Y-X(X'X)^{-1}X'Y = [I-X(X'X)^{-1}X']Y =MY$$

where e is the regression residual.

one common equality i see relating the regression residual to the error (denoted $$\epsilon$$) is:

$$e = MY = M[X \beta+\epsilon] = M\epsilon$$

my question is.. why isnt this term = 0 if we are always assuming X is exogenous when making these derivaions? Isn't $$X'\epsilon =0$$? Or is this saying that in the particular sample, $$X'\epsilon \neq 0$$?

• Please see my answer below. If you have questions, I am happy to elaborate. If you are satisfied with the answer, please accept.
– dlnB
Commented Apr 25, 2020 at 15:23

It's not that $$X'\epsilon = 0$$, but rather that $$E[X'\epsilon] = 0,$$ which is an assumption of OLS (strict exogeneity). It follows that $$E[M \epsilon] = 0$$, which tells us that $$E[e]=0$$. By construction, however, $$X'e=0$$:
$$X'e = X'Y - X'X(X'X)^{-1}X'Y = X'Y-X'Y = 0.$$