Writing the Cost Function

We define the MSE without the \( 1/n \) factor and have then, using that

$$ \boldsymbol{X}\boldsymbol{\theta}=\begin{bmatrix} 2\theta_0 \\ \theta_1 \\0 \end{bmatrix}, $$ $$ C(\boldsymbol{\theta})=(4-2\theta_0)^2+(2-\theta_1)^2+\lambda(\theta_0^2+\theta_1^2), $$

and taking the derivative with respect to \( \theta_0 \) we get

$$ \theta_0=\frac{8}{4+\lambda}, $$

and for \( \theta_1 \) we obtain

$$ \theta_1=\frac{2}{1+\lambda}, $$

Using the constraint for \( \theta_0^2+\theta_1^2=1 \) we can constrain \( \lambda \) by solving

$$ \left(\frac{8}{4+\lambda}\right)^2+\left(\frac{2}{1+\lambda}\right)^2=1, $$

which gives \( \lambda=4.571 \) and \( \theta_0=0.933 \) and \( \theta_1=0.359 \).