# Fitting a Gaussian to two Gaussians [duplicate]

Let's say I have a dataset set of 2D points. I break the dataset to 2 subsets, equal in number. Then I fit a bivariate (2D) Gaussian to each subset. So I have two bivariate gaussians, each with its own mean and covariance matrix. How do I compute the parameters of the one gaussian I would have got on the whole set from the parameters of the two subset gaussians?

The mean should be the average of the two subset's means, because they have an equal number of samples. But I'm not sure how to calculate the covariance matrix in the bivariate case.

In the univariate case, I calculated the variance to be this: $$\frac{1}{2}(Var(subset1)+Var(subset2)+ \frac{(\mu1 -\mu2)^2}{2})$$