# Is there an easy way to find the new mean of a product of gaussians?

Let's assume we have 2 gaussian functions Allowing some notation abuse they would look like:

$$G_i(x) = Ce^{\frac{-1}{2}[(x-\mu_i) / \sigma_i]^2}$$

$$G_j(x) = Ce^{\frac{-1}{2}[(x-\mu_j) / \sigma_j]^2}$$

Where $$C$$ is the constant factor of the Gaussians which I encapsulate here for simplicity.

I claim that $$G_i \cdot G_j$$ Is another Gaussian with parameters $$\mu_{ij}, \sigma_{ij}$$

But I am struggling at expressing the product as a new Gaussian to find the new parameters.

So far I have this:

$$G_i \cdot G_j(x) = Ce^{(\frac{-1}{2}[(x-\mu_j) / \sigma_j]^2) + (\frac{-1}{2}[(x-\mu_j) / \sigma_j]^2)}$$

If we focus on just the exponent and remove the constant factor we get: $$[(x-\mu_j) / \sigma_j]^2 + [(x-\mu_j) / \sigma_j]^2$$

My goal is to reorder the terms in that expression to get something of the form $$[(x-\mu_{ij})/\sigma_{ij}]^2$$

However I got stuck after getting the following:

$$\frac{(\sigma_j^2 + \sigma_i^2)x^2 + (\mu_i+\mu_j)(-2x) + (\mu_i^2 + \mu_j^2)}{\sigma_i^2\sigma_j^2}$$

I could keep going by dividing both elements of the fraction by the coefficient in front of the $$x^2$$ term but after that I am not finding an easy way to factor everything back into a singular square term on the numerator (i.e i don't know what do with $$\mu_i^2 + \mu_j^2$$).

Can this be done? Am I wrong about my hypothesis? Is there a theorem I can quote to avoid doing the entire expansion myself?

• Complete the square; you'll have a constant term left over, but since that's in an exponent you can take that out of the exponent and multiply the constant factor $C$ by something to compensate – alphacapture Apr 4 at 1:46
• Oh right! I forgot that I could kill that term that way. I'll try it tomorrow and see where that leads me. Thank you for the tip. – Makogan Apr 4 at 1:48

If, as @alphacapture commented, you write $$\frac{(x-\mu_1)^2}{\sigma_1^2}+\frac{(x-\mu_2)^2}{\sigma_2^2}=\frac{(x-\mu)^2}{\sigma^2}+\tau$$ completing the square or identifying the coefficients, you should arrive to $$\mu=\frac{\mu_2 \sigma_1^2+\mu_1 \sigma_2^2}{\sigma_1^2+\sigma_2^2}\qquad \sigma=\frac{\sigma_1 \sigma_2}{\sqrt{\sigma_1^2+\sigma_2^2}}\qquad \tau=-\frac{(\mu_1-\mu_2)^2}{\sigma_1^2+\sigma_2^2}$$ and then $$e^{-\frac{(x-\mu_1)^2}{2 \sigma_1^2}}+e^{-\frac{(x-\mu_2)^2}{2 \sigma_2^2}}=e^{-\frac \tau 2}\,e^{\frac{(x-\mu)^2}{2\sigma^2} }$$