# Is dependency created when adding one variable which is the difference of two existing variables to a regression model?

I have two variables $x_1$ and $x_2$ in linear regression. I would like to see if the distance between $x_1-x_2$ is significant. So I want to add one more variable $x_3$, which is equal to $x_1-x_2$.

But does this generate dependency and thus collinearity? If so, how can I know the effect of the distance?

Certainly there's complete linear dependence between the existing variables $(x_1,x_2)$ and their difference ($x_3=x_1-x_2$).
One way to see this is that you can write any one of the predictors as a linear combination of the other two. Specifically, $x_3$ is defined that way, but you can also write each of the others that way. [See the third paragraph of the Wikipedia article on multicollinearity]
Note in particular, that if you add some constant $\delta$ to the coefficient of $x_3$ and also add the same constant to the coefficient of $x_2$ and subtract it from the coefficient of $x_1$, the fit will be unchanged.