We can define residual as the difference between the observed value and its associated predicted value.
we can calculate the residual value as;
residual value = observed value - predicted value
When the residual value is negative it means that the observed value is less than the predicted value and when the residual value is positive it means that the observed value is greater than the predicted value. When the correlation between two variables is equal to one, the value of the residuals is equal to zero and that is the ideal residual value.