Edit: This question has been closed for being unrelated although I see similar questions posted here with the same objective, yet not with enough detailed answers or not exactly what I am looking for (e.g. this link, or this link). I do not intend that you check my algebra for mistakes. I am simply just showing my work to make it easier for the reader and to show that I put effort into solving my problem, however I could have took a wrong approach.
Question: As an exercise I am trying to marginalize a very simple joint multivariate Gaussian distribution, proceeding by completing the square I get stuck somewhere and I do not get the form I am expecting so I am hoping if anyone can advise how to proceed: $$p(y) = \int p(y,x)dx = \int p(y|x)p(x)dx $$ Where $$ p(y|x) = \frac{1}{(2\pi)^{d/2}}e^{-0.5||y-Ax||^2}$$ $A$ is just a deterministic linear transformation and $$p(x) = \frac{1}{(2\pi)^{m/2}}e^{-0.5||x||^2}$$ So completing the square in the above integral, I get: \begin{align} p(y) &= cte\times \int e^{-0.5(y^Ty -2y^TAx + x^TA^TAx + x^Tx)}dx \\\\ &= cte \times \int e^{-0.5(y^Ty + x^Tx + x^TA^TAx - 2y^TAx)}dx \\\\ &= cte \times e^{-0.5(y^Ty)} \int e^{-0.5(x^T(I_m+A^TA)x - 2y^TAx)}dx \\\\ &= cte \times e^{-0.5(y^Ty)} \int e^{-0.5(x-M^{-1}b)^TM(x-M^{-1}b)}dx e^{0.5(b^TM^{-1}b)} \\\\ &= \frac{1}{\sqrt{(2\pi)^{d}|M|}}e^{-0.5(y^Ty - b^TM^{-1}b)} \end{align}
Where the cte is basically just the normalizing constants before the gaussians and $M = I_m + A^TA$, $b = A^Ty$, and we integrate the new Gaussian density. Continuing from here: \begin{align} p(y) &= \frac{1}{\sqrt{(2\pi)^{d}|M|}}e^{-0.5y^T(I_d - AM^{-1}A^T)y} \end{align}
I think mostly think there is an additional step I am missing because I do not retrieve a Gaussian density which I expect to be of this form: \begin{align} p(y) = \frac{1}{\sqrt{(2\pi)^{d}}|AA^T + I_d|^{0.5}}e^{-0.5y^T(AA^T + I_d)^{-1}y} \end{align} I see this result in a lecture note im following (link) but they only state the method which is completing the square, I'd really appreciate any tips or at least a direction towards a reference that does these kinds of detailed derivations.
Please note that I do not want to ``apply" the direct formula or proof, I am interested more in the exact derivations. Thank you so much in advance!