In linear regression, what is the value of the sum of the residuals for a given dataset? Explain with proper justification

The sum of the residuals in a linear regression model is 0 since it assumes that the errors (residuals) are normally distributed with an expected value or mean equal to 0, i.e.

Y = βT X + ε

Here, Y is the dependent variable or the target column, and β is the vector of the estimates of the regression coefficient,

X is the feature matrix containing all the features as the columns, ε is the residual term such that ε ~ N(0, σ2).

Moreover, the sum of all the residuals is calculated as the expected value of the residuals times the total number of observations in our dataset. Since the expectation of residuals is 0, therefore the sum of all the residual terms is zero.

Note: N(μ, σ2) denotes the standard notation for a normal distribution having mean μ and standard deviation σ2.