# Gradient boosting understanding of residual picture

I recently looking at the Gradient boosting using following blog

I try to understand the picture but I need some help

For my understanding of Gradient Boosting. $$e1 = y- y_{predicted}$$ (this is right residual right)?
and then $$e1_{predicted}$$has to be added with $$y_{predicted1}$$(which is red_line).

$$y_{predicted2} = y_{predicted1}+ e1_{predicted}$$ is this going to be prediction(iteration2)??

but How they get the second red line from adding first redline + residual prediction?

I think that both $$y_{predicted1}$$ and $$e1_{predicted}$$ are output values from base regressor (decision tree) $$T_0$$ fitted on $$\{(x_i, y_i)\}_{i=1}^N$$ ($$N$$ is the size of the dataset) and $$T_1$$ fitted on $$\{(x_i, y_i - T_0(x_i))\}$$.
Generalising the training process you train the $$i$$-th regressor of the ensemble on dataset $$\{(x_i, y_i - \sum_{k=0}^{i-1}T_k(x_i))\}$$.
The final regressor $$f_M(x)$$ - an ensemble of M trees, assuming you stop training after M steps because the residual error falls below some small threshold - is $$f_M(x) = \sum_{k=0}^{M - 1}T_k(x))$$.
You can get the $$i$$-th red line just by plotting $$f_i(x)$$ (summing the predictions of the first $$i$$ base regressors).