# Question about correcting for endogeneity with an instrumental variable and Hausman test

I have the following simple regression outcome model: Y = b0 + b1*X + e, with X being potentially correlated with e. I have an instrumental variable Z correlated with X and assumed not correlated with e.

I understand that if I use an exposure model X = a0 + a1*IV + u, then I can use E(X) estimated with this model as the independent variable in the outcome model to get a corrected value for b1, because E(X) and e are not correlated.

I also understand that if I estimate the residuals from the exposure model and use it as a variable in the outcome model as Y = b0 + b1*X + b2*residuals + e, then we can test if b2=0 to test for endogeneity because b2=0 → cov(u,e)=0 → cov(X,e)=0.

What I don't understand is why by using the model including the residuals we get the same corrected regression coefficient b1 that we can find by using E(X) in the outcome model. So in other words we have:

Y= b0 + b1*E(X)

Y= b0 + b1*X + b2*residuals

Why do these two models return the same value for b1?