# Testing whether two regression coefficients are significantly different (in R ideally)

If this is a duplicate question, please point to the right way, but the similar questions I've found here haven't been sufficiently similar. Suppose I estimate the model $$Y=\alpha + \beta X + u$$

and find that $\beta>0$. However, it turns out that $X=X_1+X_2$, and I suspect $\partial Y/\partial X_1 \ne \partial Y / \partial X_2$, and in particular, that $\partial Y/\partial X_1 > \partial Y / \partial X_2$. So I estimate the model $$Y=\alpha + \beta_1 X_1 + \beta_2 X_2 +u$$and find significant evidence for $\beta_1,\beta_2>0$. How can I then test whether $\beta_1> \beta_2$? I considered running another regression $$Y=\alpha +\gamma(X_1 - X_2) + u$$ And testing whether $\gamma>0$. Is this the best way?

Also, I need to generalize the answer to many variables, i.e. suppose we have $$Y=\alpha + \beta^1 X^1 + \beta ^2 X^2 + \dots + \beta^nX^n + u$$ where for each $j=1,\dots,n$, $X^j=X_1^j+X_2^j$, and I would like to test for each $j$ whether $\partial Y/\partial X_1^j \ne \partial Y / \partial X_2^j$.

By the way, I am primarily working in R.

Let $\gamma = \beta_1 - \beta_2$.
$\beta_1 X_1 + \beta_2 X_2 = (\gamma+\beta_2) X_1 + \beta_2 X_2 = \gamma X_1 + \beta_2 (X_1 + X_2)$.
Hence the model $Y=\alpha + \beta_1 X_1 + \beta_2 X_2 +u$ becomes $Y=\alpha + \gamma X_1 + \beta_2 (X_1 +X_2) +u$
So you supply predictors $X_1$ and $X_3=X_1+X_2$, and then you can perform a straight hypothesis test of whether $\gamma>0$ (against the null of equality).