Solution (source code)

= Solution

Differentiating the ridge objective gives $(X^TX+λI)\widehat β=X^TY$, hence $\widehat μ=X(X^TX+λI)^{-1}X^TY=H_λY$.