I am trying to see the kernel trick implemented for Ridge Regression. As a first step, I want to rewrite the solution of Ridge regression. I know that:
$ \hat{\beta} = (X^TX + \lambda I_n)^{-1} X^T Y $
I think that if I can reach $ \hat{\beta} = X^T (XX^T + \lambda I_n)^{-1} Y = X^T p $
where $p = (XX^T + \lambda I_n)^{-1} Y $
I will be able to show the criterion minimized by RR and write it interms of $XX^T$
which thereafter can be replaced by the kernel operator K.
In this way I will prove how the kernel is used to calculate the inner product $XX^T$ without even visiting it.
So my question is: Can someone kindly guide me of how to go from $ \hat{\beta} = (X^T X + \lambda I_n)^{-1} X^T Y $
to $ \hat{\beta} = X^T (XX^T + \lambda I_n)^{-1} Y$
I have seen it in many books, but I didn't grasp the flow of steps. Can someone please help me with how to start this proof.