# Computing β in multiple regression (the coefficients)

In my book I have here that $$\hat\beta=(X'X)^{-1}X'Y$$, and that's fine and dandy, but I have a maybe dumb question regarding this.

So these $$β$$s are the coefficients that we must obtain from our model, but is this saying that we can obtain these coefficients simply using the formula above?

If yes, isn't this basically what we're trying to do in regression? Aren't we simply trying to find a good model and find the perfect values for the coefficients to get what we want, and we can figure that out through just this simple equation?

I guess I'm just a little confused about what we're trying to do here, if none of this makes sense let me know and it'll try to re-word it to the best of my ability

• Yes, one way to derive OLS is to show that it is the solution to the least squares problem: $\mathrm{argmin}_\beta\, \sum_{i=1}^n (y_i - x_i^T \beta)^2$. When we solve this minimization problem, we get exactly $\hat\beta = (X'X)^{-1}X'Y$. In a sense, this is trivial, since this formula just follows directly from the problem we set up. But looked at another way, that's the beauty of math: it allows us to precisely state a problem (choose a line that minimizes the sum of squared errors) and argue from this problem definition to a precise answer. Is there something else you were confused about? – stats_model Apr 9 '19 at 3:28
• @stats_model Oh wow I see that's awesome, thank you! I think that's all that I was confused about for now, if I have another question I shall be sure to post it :) – Hello Mellow Apr 9 '19 at 3:45