I have a question about the statistical and least squares interpretation of regression. For the simple linear regression case, suppose we have: $$ y= \alpha + \beta x + \epsilon $$ We are interested in an estimate of $E(y|x)=\alpha+\beta x$. Using the law of total expectations and some algebra, we get the following as the equation for $E(y|x)$.
$$ E(y|x) = \left(E(y)-\dfrac{Cov(y,x)}{Var(x)}E(x)\right) + \dfrac{Cov(y,x)}{Var(x)}x $$
Since we don't know the probability distributions of $(y,x)$, we replace the variances, expectations, and covariances on the right side with their sample counterparts in order to estimate the conditional expectation, which gives us the familiar estimates that we get from minimizing least squares: $$ {\displaystyle {\begin{aligned}{\hat {\alpha }}&={\bar {y}}-{\hat {\beta }}\,{\bar {x}},\\{\hat {\beta }}&={\frac {\sum _{i=1}^{n}(x_{i}-{\bar {x}})(y_{i}-{\bar {y}})}{\sum _{i=1}^{n}(x_{i}-{\bar {x}})^{2}}}\\\end{aligned}}} $$
I guess I have two questions here. In the multiple linear regression case, we have the following true model: $$ y = \mathbf{x}^\intercal\boldsymbol\beta + \epsilon $$ with $K$ predictors in $\mathbf{x}$. The first question is, how do we get an analogous equation for $E(y|\mathbf{x})$? It seems that it should be something like: $$ E(y|\mathbf{x})=E(y)+Cov(y,\mathbf{x})(Var(\mathbf{x}))^{-1} \left(\mathbf{x}−E(\mathbf{x})\right) . $$ Once we have the equation, how can we get, like in the simple linear regression case where we replaced first and second moments with their sample counterparts, the familiar OLS result $$ \hat{E(y|x)} = X\hat\beta = X(X^\intercal X)^{-1}X^\intercal y $$