I want to find the $\beta^*\in\mathbb R^k$ which minimizes $f(\beta) = (y - X\beta)'(y-X\beta) = \varepsilon'\varepsilon$ subject to the restriction $R\beta = r$. The standard approach would be to minimize the Lagrangian $$\mathcal L(\beta) = f(\beta)- \lambda(R\beta - r).$$
Is this the only way which is practicable? Specifically, I was thinking about rewriting the equations: $$\underbrace{\left[\begin{array}{c} y \\ r \end{array}\right]}_{=\mathbf y} = \underbrace{\left[\begin{array}{c} X \\ R\end{array}\right]}_{=\mathbf X} + \underbrace{\left[\begin{array}{c} \varepsilon \\ 0\end{array}\right]}_{=\mathbf u}$$ and then minimize $g(\beta) = \mathbf u'\mathbf u = (y - X\beta)'(y - X\beta) + 0 = f(\beta) + (R\beta - r)'(R\beta - r)$. Is this valid?
With the latter appraoch I get $$\begin{align*}\beta^* &= (X'X + R'R)^{-1}(X'y + R'r)\\&= b - (X'X)^{-1}R'(I + R(X'X)^{-1}R')^{-1}Rb + (X'X)^{-1}R'r - (X'X)^{-1}R'(I + R(X'X)^{-1}R')^{-1}R(X'X)^{-1}R'r\end{align*}$$ using the Sherman-Morrison-Woodbury formula with $b = (X'X)^{-1}(X'y)$. However, the Lagrangian appraoch yields $$\beta^* = b - (X'X)R'(R(X'X)^{-1}R')^{-1}(Rb - r).$$ Are both equations equivalent or is there a mistake somewhere?
Background: This is the deviation of the restricted least squares estimator of the linear model $y = X\beta + \varepsilon$.
Here's a solution in the spirit of your approach.
The constraint is a linear equation $$R\beta =r$$ so it has the general solution $$\beta = R^+r + Pu$$ where $R^+$ is the Moore-Penrose inverse, $\,P=(I-R^+R)\,$ is a projector into the nullspace of $R$, and $u$ is an arbitrary unconstrained vector.
NB: The projector satisfies $\,RP=0\,$ and $\,PR^+=0$
The cost function is also a linear equation. Substitute the previous result and solve for the $u$ vector. $$\eqalign{ y &= X\beta \cr&= X(R^+r + Pu) \cr XPu &= y- XR^+r \cr u &= (XP)^+(y- XR^+r) \cr }$$ Finally, substitute this back into the general solution to obtain the constrained solution. $$\beta = R^+r + P(XP)^+(y- XR^+r)$$