# Identifying a distribution

I am trying to understand what sort of distribution is produced by the following code.

Using the following Matlab code we can generate a distribution (normalized such that the sum of the set is equal to 1):

M=500; % Number of samples
z=5;
SUM = 1;
ns = rand(1,M).^z; % Uniformly distributed random numbers to the power of z
TOT = sum(ns);
X = (ns/TOT)*SUM; % Re-scaling
hist(X(1,:),100)


For the exponent $$z=1$$ the sampling distribution is essentially "flat", and it also has a small range. Enlarging $$z$$ gives a wider range of numbers. Here is an example: I would like to classify this distribution and understand the underlying mathematics.

Any explanations would be greatly appreciated.

• Similar method, different distribution. Not sure that makes it a duplicate. – BruceET Jun 18 at 17:30
• @AdamO the question you link to is about $e^X$ where $X \sim \text{Uniform}(0, 1)$ while this question is asking about $X^z$. This leads to a different distribution. – olooney Jun 18 at 17:35

I will show this for $$U^2,$$ instead of $$U^5.$$ See @olooney's comment below my Answer.

Short answer: If $$U \sim \mathsf{Unif}(0,1),$$ then $$X = U^2 \sim \mathsf{Beta}(\frac 1 2, 1).$$

Proof: For $$x \in (0,1),$$ we have $$F_X(x) = P(X \le x) = P(U^2 \le x) = P(U \le x^{1/2}) = x^{1/2}.$$ Then $$f_X(x) = F_X^\prime(x)$$ is easily seen to be the density of $$\mathsf{Beta}(\frac 12, 1).$$ See Wikipedia on beta distributions.

Demonstration by simulation:

set.seed(618)
u = runif(10^6);  x = u^2
mean(x)
 0.3330528     # aprx E(X) = 1/3 from simulation
.5/(.5+1)
 0.3333333     # exact E(X) from formula

cutp.u = seq(0, 1, by = 0.1);  cutp.x = cutp.u^2
frb = rainbow(12)
par(mfrow = c(1,3))
hist(u, prob=T, br=cutp.u, col=frb, ylim=c(0,10), main="UNIF(0,1)")
curve(dunif(x), 0, 1, add=T, n=10001, lwd=2)
hist(x, prob=T, br=cutp.x, col=frb, main="BETA(.5,1)")
hist(x, prob=T, br=40, col="skyblue2", main="BETA(.5,1)")
curve(dbeta(x, .5, 1), add=T, n=10001, col="red")
par(mfrow = c(1,1)) In the first and second histograms, each bar contains about 100,000 simulated values. For the beta distribution in the middle histogram, each bar is the image of a bar of the same color in the first histogram. Ordinarily, it is not useful to make histograms with bins of unequal width, so the third histogram shows the simulated beta distribution (and its density function in red) in a more familiar way.

• Very nice! However, because the question concerns the $z=5$ power rather than the square, it would be better to generalize your answer a little. – whuber Jun 18 at 17:34
• Generalizes to $X^z \sim \text{Beta}(1/z, 1)$, where $X \sim \text{Uniform}(0, 1)$. – olooney Jun 18 at 17:40
• Both absolutely correct. I'm still fussing with this. Will edit accordingly: (a) Not sure if it's homework, so want to show method without just being an answerbook. (b) Difficult to show clear graphs for $z = 5.$ – BruceET Jun 18 at 17:45
• Thanks a lot for the explanations. No, this is not a homework problem. I was working on a physical simulation looking for a distribution that can model the distribution of light in multimode optical fibers. So I came across this distribution and I wasn't quite sure what it was. – Merin Jun 19 at 0:03
• It seems nobody (including the OP) cares about the summation performed after the transformation. The resulting RVs are of the form $$\frac{X_i}{\sum_i X_i}$$ – gunes Jun 19 at 0:54