Let $X$ be exponential random variable with parameter $\beta$ $$ P_X(x)=\frac{1}{\beta}e^{-x/\beta}. $$

I have found a lemma saying

Let $X$ be a random variable with pdf $p_X (x)$ for all $x\geq 0$ and $p_X (x) = 0$ for $x < 0$. Then, the pdf of $Y = 1/ X$ is $$ P_Y(y)=\frac{1}{y^2}P_X(\frac{1}{y}). $$

My question is, How we use MATLAB with Monte Carlo simulation to generate or simulate $X$ and compared with theoretical PDF $P_X(x)$ and also simulate $P_Y(y)$ and compared with theoretical expression.


The classical way to simulate an $Exp[\beta]$ random variable is by considering random variable

$$X'=-\beta \log(U)$$

where $U$ is uniformly distributed on $[0,1] \ $ ($\log$ is the natural logarithm). It is easy to prove that $X'$ has a $Exp[\beta]$ distribution.

Thus the simulation program in Matlab is :

 clear all;close all;

Second part : What can be said about $Z$ defined by


with $X,Y$ following a $Exp[\beta]$ distribution ?

The problem with the inverse of an $Exp[\beta]$ distribution (like $\dfrac{1}{X}$ or $\dfrac{1}{Y}$) is that it has an infinite mean, thus a non-defined variance (https://stats.stackexchange.com/questions/229543/mean-of-inverse-exponential-distribution)

Thus, instead of simulating $1/X$; $1/Y$, adding them and taking the inverse, I have directly done this simulation, for the particular case $\beta=1$ :

 clear all;close all;

The results I obtain tend to give $E(Z)=\dfrac{1}{3}$ and $var(X)=\dfrac{4}{45}$.

Here is the histogram generated by this program. One notices that after a certain small peak, there is rapid decline.

I have no idea about the way to get these results throretically.

enter image description here

  • $\begingroup$ Hi soory i was not here i have random varible $z=\frac{XY}{X+Y}=\frac{1}{\frac{1}{X}+\frac{1}{Y}}$ $\endgroup$ – Mokhtar Apr 13 '18 at 23:06
  • $\begingroup$ Do you mean that $X,Y$ are both $Exp[\beta]$ and your desire is to be able to simulate $Z=XY/(X+Y)$ ? Besides, do you know the theoretical distribution followed by this $Z$ ? $\endgroup$ – Jean Marie Apr 14 '18 at 0:38
  • $\begingroup$ yes i want to simulat $Z$ $\endgroup$ – Mokhtar Apr 14 '18 at 20:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.