I am trying to understand how the general 2D Gaussian (binormal / bivariate) equation is derived as part of my work, and am having trouble expanding the terms. The article on Wikipedia (https://en.wikipedia.org/wiki/Gaussian_function#Two-dimensional_Gaussian_function) lists the general equation as being:
$$f(x, y) = A\exp\left(-\left(a(x-x_{o})^2 + 2b(x-x_{o})(y-y_{o}) + c(y-y_{o})^2\right)\right)$$
Where: $$a=\frac{\cos^2\theta}{2\sigma_{x}^2} + \frac{\sin^2\theta}{2\sigma_{y}^2}$$ $$b=-\frac{\sin2\theta}{4\sigma_{x}^2} + \frac{\sin2\theta}{4\sigma_{y}^2}$$ $$c=\frac{\sin^2\theta}{2\sigma_{x}^2} + \frac{\cos^2\theta}{2\sigma_{y}^2}$$ $A$ is a scaling factor, and $\theta$ is the angle by which the Gaussian is rotated.
In R. J. Barlow's book "Statistics: A Guide to the Use of Statistical Methods in the Physical Sciences" shows that the normalised 2D Gaussian equation can be represented as follows:
$$f(x, y) = \frac{1}{2\pi\sigma_{x}\sigma_{y}\sqrt{(1-\rho^2)}} \exp\left\{-\frac{1}{2(1-\rho^2)}\left[\left(\frac{x-\mu_{x}}{\sigma_{x}}\right)^2 + \left(\frac{y-\mu_{y}}{\sigma_{y}}\right)^2 - 2\rho\left(\frac{x-\mu_{x}}{\sigma_{x}}\right)\left(\frac{y-\mu_{y}}{\sigma_{y}}\right)\right]\right\}$$
Where $\rho$ is the correlation factor for $x$ and $y$, given as: $$\rho=\frac{\mathrm{cov}(x, y)}{\sigma_{x}\sigma_{y}}$$
In expanding and playing around with the formula for the exponent, I find that the terms can apparently be matched up as follows:
$$a=\frac{\cos^2\theta}{2\sigma_{x}^2} + \frac{\sin^2\theta}{2\sigma_{y}^2} = \frac{1}{2\sigma_{x}^2(1-\rho^2)}$$ $$b=-\frac{\sin2\theta}{4\sigma_{x}^2} + \frac{\sin2\theta}{4\sigma_{y}^2} = -\frac{\rho}{2\sigma_{x}\sigma_{y}(1-\rho^2)}$$ $$c=\frac{\sin^2\theta}{2\sigma_{x}^2} + \frac{\cos^2\theta}{2\sigma_{y}^2} = \frac{1}{2\sigma_{y}^2(1-\rho^2)}$$
Could someone help explain how the $\rho$ terms can be expanded to give said relationships? I have a basic grasp of matrix operations and trigonometry, so simple explanations and/or undergraduate-level resources to help better understand this derivation would be much appreciated.
Thanks!