What is the normal equation for multivariate linear regression?
In the case of monovariate linear regression, using ordinary least squares, to obtain $\theta^* = \text{argmin}_{\theta} \sum_{i=1}^m (\theta^T X_i - Y_i)^2$ one can use the closed form $\theta^* = (X^TX)^{-1}X^TY$ (proof: (1)).
I wonder how to get a closed form of $\theta$ when $Y_i$ is a vector, i.e. in the case of multivariate linear regression. (I know one could use gradient descent instead).
The minimization criterion I'd like to use for the multivariate linear regression is the following: $$\theta^* = \text{argmin}_{\theta} \sum_{i=1}^m{|| \theta X_i - Y_i ||^2}$$
(1) Proof of the normal equation:
Using matrix notation, the sum of squared residuals is given by
$$S(b) = (y-Xb)'(y-Xb)$$
Since this is a quadratic expression and $S(b) \geq 0$, the global minimum will be found by differentiating it with respect to $b$:
$$0 = \frac{dS}{db'}(\hat\beta) = \frac{d}{db'}\bigg(y'y - b'X'y - > y'Xb + b'X'Xb\bigg)\bigg|_{b=\hat\beta} = -2X'y + 2X'X\hat\beta$$
By assumption matrix $X$ has full column rank, and therefore $X'X$ is invertible and the least squares estimator for $β$ is given by
$$\hat\beta = (X'X)^{-1}X'y$$