Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What's the expected value of the expression: $x^{random(y, y+1)}$ where $random(a,b)$ is a uniformly random real number between a and b.

Simple testing confirms my suspicion that this is not simply $x^{E[random(y, y+1)]}$, i.e. $x^{y+0.5}$.

(I'm coming up with some exponential backoff retry logic for a system that involves this randomization to prevent "collisions", and I'm trying to analyze its expected cumulative retry time.)

share|cite|improve this question
up vote 1 down vote accepted

The expected value of $f(X)$ for some random variable $X$ is calculated as follows: $\mathbb{E}(f(X)) = \int f(x)p(x)dx$ for $p$ the probability density function associated to $X$.

In your case we have: $\mathbb{E} x^n = \int_y^{y+1} x^n dn = \left[\frac{1}{\log x}x^n\right]^{y+1}_y = \frac{1}{\log x}\left(x^{y+1}-x^y\right)$

share|cite|improve this answer
$\int x^n\,dn\ne(1/(n+1))x^{n+1}$. – Gerry Myerson Jun 6 '11 at 7:20
Yeah, you're right. I changed it. Bit too used to x as a variable... – gfes Jun 6 '11 at 7:21
Thanks, Shai Covo's answer was also useful (explicitly stating what $p(x)$ in your equation resolved to). But this answer actually stated the final formula. Let me just make sure and test this... – Maian Jun 6 '11 at 7:38
@Maian: I already tested it, and it is correct. – Shai Covo Jun 6 '11 at 7:46
Okay, I just tested it too :) – Maian Jun 6 '11 at 7:47

If $Z$ is a uniform random variable on $(y,y+1)$, then it has density function $f_Z$ given by $f_Z (s) = 1$ if $y < s < y+1$, and $f_Z (s) = 0$ otherwise. Thus, $$ {\rm E}[x^Z ] = \int {x^s f_Z (s)ds} = \int_y^{y + 1} {x^s ds} = \ldots . $$

share|cite|improve this answer
Is $f_Z(s)=1$ because $y-(y+1)=1$? I thought the pdf of a uniform distribution was $1/(b-a)$ where for $a<x<b$ (or something like that). – Maian Jun 6 '11 at 7:38
You're exactly right. $f_z(s) = \frac{1}{(y+1)-y} = 1$ here. – gfes Jun 6 '11 at 7:42
@Maian: Indeed, $f_Z (s) = 1$ (for $y < s < y+1$) because $(y+1)-y=1$ (here $a=y$ and $b=y+1$, hence $1/(b-a)=1$). – Shai Covo Jun 6 '11 at 7:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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