I think this is a very nice problem. If I may change notation slightly ...
The Problem
Let $\quad W \sim N(\mu_0, \sigma_0^2), \quad X_1 \sim N(\mu_1, \sigma_1^2), \quad X_2 \sim N(\mu_2, \sigma_2^2)$
denote independent random variables, and let $c$ denote a constant.
Find the pdf of $Z$, where:
$$ Z = \begin{cases}W + X_1 & \text{if } W \leq c \\ W + X_2 & \text{if } W > c \end{cases}$$
Solution
To solve this, we need to solve 2 problems.
Find $h_1(z)$: the pdf of $(W + X_1) \, \big| \, (W \leq c) \quad $ (i.e. truncated-above Normal + Normal)
Find $h_2(z)$: the pdf of $(W + X_2) \, \big| \, (W > c) \quad $ (i.e. truncated-below Normal + Normal)
Then the pdf of $Z$, say $h(z)$, is the component mix:
$$h(z) \, = \, P(W \leq c) * h_1(z) \quad + \quad P(W>c) * h_2(z)$$
Solution: Part 1
$\rightarrow$ The pdf of the sum of a truncated-above Normal and a Normal
If $W$ is truncated ABOVE at $c$, ... then the joint pdf of $(W \big|(W \leq c),X_1)$, say $f_1(w,x_1;c)$, is, by independence, simply the product of the respective individual pdf's ... that is, $f_1(w,x_1;c) = \frac{f_w(w)}{P(W<c)} * f_{x_1}(x_1)$:
Next, transform $(W,X_1) \rightarrow (Z=W+X_1, V=X_1)$. Here is the joint pdf of $(Z, V)$, say $g_1(z,v)$:
where:
I am using the Transform
function in the mathStatica package for Mathematica to do the nitty-gritties.
Note that the transformation equation $(Z=W+X_1, V=X_1)$ induces dependency between $Z$ and $V$. In particular, since $Z=V+W$ and $W < c$, it follows that $Z < V + c$. This important constraint is entered using the Boole[ blah ]
statement above.
Erf[.]
denotes the error function
We seek the marginal pdf of $Z = W + X_1$, say $h_1(z)$, which is:
... defined on the real line. This concludes Part 1.
Solution: Part 2
$\rightarrow$ The pdf of the sum of a truncated-below Normal and a Normal
If $W$ is truncated BELOW at $c$, ... then the joint pdf of $(W \big|(W > c),X_2)$, say $f_2(w,x_2;c)$, is, by independence, simply the product of the respective individual pdf's ... that is, $f_2(w,x_2;c) = \frac{f_w(w)}{P(W>c)} * f_{x_2}(x_2)$:
Next, transform $(W,X_2) \rightarrow (Z=W+X_2, V=X_2)$. Here is the joint pdf of $(Z, V)$, say $g_2(z,v)$:
- Note that the transformation equation $(Z=W+X_2, V=X_2)$ induces dependency between $Z$ and $V$. In particular, since $Z=V+W$ and $W > c$, it follows that $Z > V + c$. This important constraint is entered using the
Boole[ blah ]
statement above.
We seek the marginal pdf of $Z = W + X_2$, say $h_2(z)$, which is:
...defined on the real line. This concludes Part 2.
The Component Mix
All the necessary pieces to the puzzle are now in place. To make this explicit, if $W \sim N(\mu_0, \sigma_0^2)$ with pdf $f(w)$:
... then $P(W<c)$ is:
Recall that the pdf of $Z$ is:
$$h(z) \, = \, P(W \leq c) * h_1(z) \quad + \quad P(W>c) * h_2(z)$$
... which is explicitly:
where $Z$ is defined on the real line. All done.
Monte Carlo check
It is always a good idea to check symbolic work using alternative methods. Here is a quick Monte Carlo check when:
$\text{params}=\left\{\mu _0\to 16,\mu _1\to 3,\mu _2\to 2,\sigma _0\to 6,\sigma _1\to 0.1,\sigma _2\to 2,c\to 12\right\}$
The following plot compares:
- a Monte Carlo simulation of the pdf of $Z$ (squiggly BLUE curve) to the
- theoretical solution derived above (dashed RED curve)
Looks fine :) Different parameter choices can, of course, yield very different shaped outcomes.
Mean of $Z$
Paulius Ĺ arka asks: "Does the mean of Z have an analytical form"
Yes - it is easiest to derive this from:
$$ Z = \begin{cases}W + X_1 & \text{if } W \leq c \\ W + X_2 & \text{if } W >c\end{cases}$$
... it follows that:
$$E[Z] = P(W \leq c) \big(E[W \big | W \leq c] + \mu_1 \big) \quad + \quad P(W>c)\big(E[W \big | W > c] + \mu_2 \big)$$
which yields the closed-form solution:
$$E[Z] \quad = \quad \mu_0 \, + \, P(W \leq c) \mu_1 \, + \, P(W > c) \mu_2$$
Best Answer
This question should really have a self study tag and even if it has not, the answer cannot be complete.
Now from Wikipedia we can learn, how sums of normally distributed values are distributed: https://en.wikipedia.org/wiki/Sum_of_normally_distributed_random_variables
In your above attempt at solving this you computed the new mean as $5\times 7$ and the new variance as $5^2\times 49$. Now which of these computations does what the Wikipedia tells you to do and which one does not?
Edit after @JakubL 'S comment under this answer:
You are correct now. If you use R, you can easily simulate that like this:
And if we use $Y$ follows $N(5\times 7, 5\times 49)$ the result is the same: