Assume I run the following regression:

$$ sales = \beta_{0} + \beta_{1} price + \beta_{2}advert + \beta_{3}advert^2 $$

Now I regress sales, price, and advertising separately on advertising_squared and store for each of the three regressions the residuals. Then I regress the sales residuals on the advertising residuals and price residuals (K=2) without a constant.

Why are the coefficients on price and advertising the same as in the first regression? I know that it has something to to with partialling out but I cant formulate what mathematically happens.