# question~sum of (residual*Xi)

#### dandelion

##### New Member
Hi,
I know it might sound stupid but I do not understand why the fact that sum of residuals equals zero implies the sum of (residual i*Xi) equals the sum of (residual i *(Xi-average of Xi). The equation in the image attached(where u means residual) seems to be based on the same logic which I do not understand. Also, why the sum of (residual i*Yi) equals zero?
Thank you very much if you can shed some light onto this.

Last edited:

#### BGM

##### TS Contributor
Remember that $$\bar{x}$$ is independent of the dummy variable $$i$$. Therefore

$$\sum_{i=1}^n (\hat{u}_i - \bar{\hat{u}}) = 0$$ implies that

$$\sum_{i=1}^n \bar{x}(\hat{u}_i - \bar{\hat{u}}) = \bar{x}\sum_{i=1}^n (\hat{u}_i - \bar{\hat{u}}) = 0$$

#### dandelion

##### New Member
Thank you, that answered my second question.
Can you also give me some hint on the first and third question, which are
the sum of (residual i*Xi) equals the sum of (residual i*(Xi-average X)). and
the sum of (residual i*Yi) equals zero
Thank you.

#### Dragan

##### Super Moderator
.... and the sum of (residual i*Yi) equals zero
Thank you.
You're asking the wrong question. Rather, it's the sum of the residuals with the predicted (not the actual) values of Y (Yhat) i.e. Sum(residual_i *Yhat_i) = 0

#### dandelion

##### New Member
Oops. Sorry, I did not notice that. Thanks, I know how it works now after you pointed it out.
Also, just found that BGM's hint also works for my first question