# Matrix Commutation, is it valid here?

I'm trying to obtain the Ridge Regression solution from the mean of predictive distribution of a Gaussian Process with a linear kernel.

The mean of the predictive distribution of a GP is $$\boldsymbol k^T(\boldsymbol K+\sigma^2I)^{-1}y$$

where $$\boldsymbol K=k(\boldsymbol X^T, \boldsymbol X)$$ is the Kernel Gram Matrix (Symetric Positive definite) and $$\boldsymbol k = k(x_{n+1},\boldsymbol X)$$. (Note that $$x_{n+1}$$ is a vector while $$\boldsymbol X$$ is a matrix

Now I'm assuming a linear kernel, thus $$k(\boldsymbol X^T, \boldsymbol X) = \boldsymbol X^T \boldsymbol X$$ and $$\boldsymbol k = k(x_{n+1},\boldsymbol X) = x_{n+1}^T* \boldsymbol X$$. So I can write $$\boldsymbol k^T(\boldsymbol K+\sigma^2*I)^{-1}y = (x_{n+1} \boldsymbol X^T) (\boldsymbol X^T \boldsymbol X+\sigma^2*I)^{-1}y$$

Now the issue: The Ridge Regression should be $$x_{n_1}(X^TX+\sigma ^2 I)^{-1}\boldsymbol X^T y$$ while I have $$(x_{n+1} \boldsymbol X^T) (\boldsymbol X^T \boldsymbol X+\sigma^2*I)^{-1}y$$

So I need to commute $$\boldsymbol X^T$$ and $$(\boldsymbol K+\sigma^2I)^{-1}$$ but I know matrix cannot commute, so I'm stucked.

What am I missing? Can you help me?

Note that $$(\boldsymbol K+\sigma^2I)^{-1}$$ is a symmetric matrix.