Calculate the number of elements using the total of combinations

32 Views Asked by At

When $k$ equals to $2$, the number of combinations of $n$ elements can be obtained using the formula:

$$\frac{n!}{2\cdot(n-2)!}.$$

Is there a practical way/formula to find the number of elements $n$ given the total of combinations?

3

There are 3 best solutions below

1
On BEST ANSWER

With $k=2$, yes there is a practical way. Note that $$n!=n\cdot(n-1)\cdot(n-2)!,$$ so your expression simplifies to $$\frac{n!}{2\cdot(n-2)!}=\frac{n\cdot(n-1)}2=\frac12n^2-\frac12n.$$ If you are already given that you have $t$ total combinations, your question amounts to solving the quadratic $$\frac12n^2-\frac12n=t$$ for $n$. The quadratic formula yields $$\begin{aligned}n&=\frac{-\left(-\frac12\right)\pm\sqrt{\left(-\frac12\right)^2-4\cdot\frac12\cdot(-t)}}{2\cdot\frac12}\\&=\frac12\pm\sqrt{\frac14+2t}\\&=\frac12\pm\frac12\sqrt{1+8t}.\end{aligned}$$

Since $t\geq 1$, the discriminant is always at least $9$, so if we subtract rather than add we find a negative value for $n$, contradicting the physical interpretation of a count. Hence, we only want the greatest root. $$\boxed{\frac12+\frac12\sqrt{1+8t}.}$$

0
On

Note that $\dfrac{n!}{2(n-2)!}=\dfrac{n(n-1)}{2}$. You have to solve $N=n(n-1)/2$, with $N$ the number of combinations.

Therefore you get $n=\dfrac{1+\sqrt{1+8N}}{2}$.

0
On

My idea would be the following: Being given such a result - say $r$ - of your formula, to obtain $n$, first multiply $r$ by two. Then $2r=n*(n-1)$. Now note the following inequalities:

$n-1 = \sqrt{(n-1)^2} < \sqrt{2r} = \sqrt{n(n-1)} < \sqrt{n^2} = n$

Therefore, take the squareroot of the double of your result, round it off to obtain $n-1$ and then add one to obtain $n$.