# How to find (or 'generate') combinatorial meaning for the given expression

$\left(\dfrac{6(k-n)(k-1)}{(n-2)(n-1)}+1\right)\dfrac{30}{n(n+1)(n+2)}$ (for $n\geq 3$ and $1\leq k \leq n$)

The expression comes from question Please help to find function for given inputs and outputs where it is used to get answer for some unknown problem (I believe that's combinatorial, with possibility of used Monte-Carlo method). The OP didn't give any interpretation of the expression.

P.S. There's tiny possibility that it was mathematical/SE joke.

-
That's an expression, not a formula. – Michael Joyce Feb 16 '13 at 15:23
@MichaelJoyce Thank you. Fixed. – zaarcis Feb 16 '13 at 15:25
This is just my attempt to rewrite the formula in a more appealing and symmetric way (symmetric with respect to $k$ vs $n+1-k$): $$\frac{30\Big((n+1)(n+2)-6k(n+1-k)\Big)}{(n-2)(n-1)n(n+1)(n+2)}$$ For all I know, this formula could be an essential component of the North Korea nuclear program. This was discussed on meta – user53153 Feb 19 '13 at 18:02

I want a quadratic function with zero mean defined on $\{1,\dots,n\}$. Naturally, it should be symmetric about the midpoint of the interval. The obvious symmetric function is $k(k-n-1)$, but it does not have mean zero. The mean is $$\frac{1}{n}\sum_{k=1}^n k(k-n-1) = -\frac{(n+1)(n+2)}{6}$$ So I subtract that, arriving at $k(k-n-1)+\frac{(n+1)(n+2)}{6}$. But maybe I also care about the second moment, which is $$\sum_{k=1}^n \left(k(k-n-1)+\frac{(n+1)(n+2)}{6}\right)^2 = \frac{(n-2)(n-1)n(n+1)(n+2)}{180}$$ Dividing by the second moment yields $$\frac{180}{(n-2)(n-1)n(n+1)(n+2)}\left(k(k-n-1)+\frac{(n+1)(n+2)}{6}\right)$$ which is the formula in question.