# Finding the sum of two independent Normal Mixture Distributions using Mathematica

Suppose random variable $$X_1$$ is a mixture of two Normal distributions with means of $$\mu_A$$ and $$\mu_B$$ respectively, standard deviations of $$\sigma_A$$ and $$\sigma_B$$ respectively, and weights given by $$w_{1_A}$$ and $$w_{1_B}$$. Suppose further that another random variable exists, $$X_2$$, which is independent of $$X_1$$, but is also a mixture of two Normal distributions. Furthermore, $$X_2$$ has the same means and standard deviations as $$X_1$$, but has its own weights given by $$w_{2_A}$$ and $$w_{2_B}$$. Can I use Mathematica to find $$X_1$$ + $$X_1$$?

I have tried:

\[ScriptCapitalD] = MixtureDistribution[{w1A, w1B}, {NormalDistribution[muA, sdA], NormalDistribution[muB, sdB]}]  + MixtureDistribution[{w2A, w2B}, {NormalDistribution[muA, sdA], NormalDistribution[muB, sdB]}]


but apparently the problem is beyond Mathematica. Any suggestions as to how I can, nevertheless, use Mathematica to work this out?

• Adding 2 distributions directly is meaningless in MMA. You need to use TransformedDistribution to add the r.v.'s and even then what you get is usually a symbolic distribution indicating your intentions. Use PDF etc. to derive concrete results. Dec 6 '19 at 2:56

To get the distribution of the sum of random variables use TransformedDistribution

Clear["Global*"]

\[ScriptCapitalD]1 =
MixtureDistribution[{w1A, w1B}, {NormalDistribution[muA, sdA],
NormalDistribution[muB, sdB]}];

\[ScriptCapitalD]2 =
MixtureDistribution[{w2A, w2B}, {NormalDistribution[muA, sdA],
NormalDistribution[muB, sdB]}];

\[ScriptCapitalD] = TransformedDistribution[x1 + x2,
{x1 \[Distributed] \[ScriptCapitalD]1,
x2 \[Distributed] \[ScriptCapitalD]2}];

PDF[\[ScriptCapitalD], x]

(* w1B ((E^(-((muA + muB - x)^2/(2 (sdA^2 + sdB^2)))) sdB w2A)/(
Sqrt[sdA^2 + sdB^2] (w2A + w2B)) + (E^(-((-2 muB + x)^2/(4 sdB^2))) w2B)/(
Sqrt[2] (w2A + w2B))))/(Sqrt[2 π] sdB (w1A + w1B)) + (
w1A ((E^(-((-2 muA + x)^2/(4 sdA^2))) w2A)/(Sqrt[2] (w2A + w2B)) + (
E^(-((muA + muB - x)^2/(2 (sdA^2 + sdB^2)))) sdA w2B)/(
Sqrt[sdA^2 + sdB^2] (w2A + w2B))))/(Sqrt[2 π] sdA (w1A + w1B)) *)
`