# Probability of generating higher number

1. Mar 28, 2015

### Vrbic

Hello, I have a query:
If I have two normal distribution with different mean value and variability. I am generating numbers by them. How can I compute probability, that one of them (with higher mean value for example) going to generate next number higher than the latter?

2. Mar 28, 2015

### Orodruin

Staff Emeritus
Construct a new stochastic variable based on the two you have that easily lets you describe whether or not a particular variable is larger than the other (can you think of one?). Then compute the probability of this happening based on the distribution of the new stochastic variable.

3. Mar 28, 2015

### Vrbic

It seems very easy but you are probably in mathematic far than me :) Intuitively I suspect where should I get, but practically I have a problem how define my new variable. Could you suggest some few steps?

4. Mar 28, 2015

### Vrbic

And thanks for help ;)

5. Mar 28, 2015

### Orodruin

Staff Emeritus
How would you judge if a number is larger than another?

6. Mar 28, 2015

### Vrbic

Ou heck :) Difference is negative :)

7. Mar 28, 2015

### Orodruin

Staff Emeritus
Yes, or positive, depending on which difference you take. So how do you check the probability of the difference being negative?

8. Mar 28, 2015

### Vrbic

If it is less than zero it is negative. Now I don't understand where you are pointing.

9. Mar 28, 2015

### Staff: Mentor

Can you find the probability distribution of the difference?

10. Mar 30, 2015

### Vrbic

I don't know. I have two normal distribution function with different mean value and variability. I know exact formulas these functions but I can't prepare a new one which will describe a distribution of new variable which is difference of tow randomly generated numbers by these normal distribution functions. I need bigger hint please :)

11. Mar 30, 2015

### Orodruin

Staff Emeritus
If you have a normally distributed variable $X$ with mean $\mu$ and variance $V$, what is the distribution of $-X$?

If you have two normally distributed variables $X$ and $Y$, what is the distribution of the sum $X+Y$?

12. Apr 2, 2015

### Vrbic

a) Im not sure but I guess that the mean $\mu$ -> $- \mu$. Variance is same.

b) Again guess but distribution of the sum $X+Y$ should be normal distribution with mean $\mu_X + \mu_Y$ but Im not sure what about variance...

13. Apr 2, 2015

### Orodruin

Staff Emeritus
What is the variance of any sum of two stochastic variables? You can derive this from the definition of the variance.

14. Apr 2, 2015

### Vrbic

Hm def. should be: $\sigma^2=\int^{\infty}_{-\infty}x^2f(x)dx-[\mu(x)]^2$ it seems nice but if I don't know $\sigma^2$ I don't know f(x). So I am quite confused. Honestly, I guess variance will always grow. So probably $V(x-y)=V(x)+V(y)$. But I would like to know how to derive that.

15. Apr 2, 2015

### Staff: Mentor

You can express the variance of one variable in terms of two expectation values (a simplified version of your formula). That allows to modify them without integrals.

16. Apr 2, 2015

### Orodruin

Staff Emeritus
Well, this is not quite true. What is true is that a normal distribution takes two parameters and that one of them can be taken to be the variance. With the appropriate f(x) you will then recover $\sigma^2 = \sigma^2$, but this is not what we are after now. We are after a general statement about variances and you need to go back to the very definition (you can do it completely without integrals just using the properties of expectation values).

17. Apr 3, 2015

### Vrbic

So do you mean "discreet definition" in this way: $\sigma^2=\sum [x_i-\mu(x)]^2p_i$?

18. Apr 3, 2015

### Orodruin

Staff Emeritus
No. I mean the more abstract definition V(X) = E((X-E(X))^2).

19. Apr 3, 2015

### Vrbic

Ah I see... sorry.
So now I should substitute X->X-Y. Ok? And wirte $V(X-Y) = E[(X-Y-E(X-Y))^2]=E[(X-Y-E(X)-E(Y))^2]=...=$
$=E[(X-E(X))^2] + E[(Y-E(Y))^2] + E[-2XE(Y)-2YE(X)]=V(X)+V(Y)+ E[-2XE(Y)-2YE(X)]$ if I can split mean $E(X-Y)=E(X) - E(Y)$. Am I right? But what about extra term $E[-2XE(Y)-2YE(X)]$ ??

20. Apr 3, 2015

### Orodruin

Staff Emeritus
E(X) is just a constant and can be moved out of the expectation value due to linearity.