I'm trying to compute the number of ways to sum the first $n$ unique positive integers to a number $k$. This is not a partition of $n$ since we can't repeat numbers.
Any hints on how I can derive a generating function for this?
I encountered this in trying to compute the variance of the sum of $k$ balls randomly drawn from an urn of $n$ balls (where each ball is labeled with a unique positive integer from $1...n$). Letting $S$ be the random variable which is this sum, computing the variance using the definition of expectation directly uses $P(S = k) = \frac{N_{n,k}}{{n\choose k}}$, where $N_{n,k}$ denotes the desired quantity above. I can compute the variance by writing $S$ as a sum of indicators and expanding the expression inside of the expectation, but I was wondering if there was a nice expression for the above quantity.
Thank you!
Edit: this answer was written for a previous version of the question, which asked how to compute the variance.
The distribution is not needed to compute the variance. Let $X_i \in {1,2 \cdots n}$, for $i\in {1,2 \cdots k}$, be the result of the $i-$th extraction. CLearly $X_i$ are identically distributed, but not independent.
Let $S=\sum_{i=1}^k X_i$
We have $E[S]=k E[X_1] = k \frac{n+1}{2}$
And $E[S^2] = k E[X_1^2 ]+ k(k-1)E[X_1 X_2]$
For the last term you can use $E[X_1 X_2]=E[X_1E[X_2 \mid X_1]]$
Can you go on from here?
I got $$Var(n,k) = \frac{k\,\left( n+1\right) \,\left( n-k\right) }{12}$$
At least it sounds consistent : $Var(n,n)=0$,$Var(n,1)=Var(X_1)$ and $Var(n,k)\to k n^2/12 $ for $n\gg k$
Edit: here goes some detail.
$$E[X_1^2 ]=\frac{2{{n}^{2}}+3n+1}{6}$$
$$E[X_1 | X_2 =j] =\frac{1}{n-1}\left( -j + \sum_{i=1}^n i \right)=\frac{1}{2n-2}\left( n^2 +n -2j \right)$$
$$E[X_1 X_2 ] =\frac{1}{2n-2}\left( (n^2+n)E[X] -2 E[X^2] \right)=\frac{3{{n}^{2}}+5n+2}{12}$$
$$E[S^2] = \frac{k\,\left( n+1\right) \,\left( 3kn+n+2k\right) }{12}$$
$$\sigma_S^2(n,k)=E[S^2] -E[S]^2= \frac{k\,\left( n+1\right) \,\left( n-k\right) }{12}$$