Counting valid tickets

100 Views Asked by At

I think my question is very easy but I need to understand. The problem is, I have a ticket with 2 numbers from 1 to 10. The first number cannot be greather than the second number. How many valid ticket do I have? Is there any formula to solve that? Because I have tried with permutation formula but it doesn't take care of sorting.

Thank you for your explanations.

3

There are 3 best solutions below

4
On BEST ANSWER

Say you have $2$ numbers between $1$ and $n$. For valid tickets, the first number is not greater than the second number.

We count the valid tickets: First, all $n$ tickets having twice the same number are valid.

Among the remaining $n^2 - n$ tickets with two different numbers, every second ticket is valid (since swapping the numbers makes a valid ticket invalid and an invalid one valid).

So the result is $$n + \frac{n^2 - n}{2} = \frac{n^2 + n}{2}.$$

For $n=10$, you get $\frac{10^2 + 10}{2} = 55$.

1
On

Think of it this way - if each number can be anything from 1 to 10, then how many different tickets would you have?

$10*10 = 100$

However, almost every allowed ticket has a mirrored one that's not allowed ($3-10$ is okay, $10-3$ is not). It's not exactly half of the overall total, though, because in some ($5-5$, $3-3$, etc.) the order doesn't matter. So, if you take the total number of tickets, subtract out the ones where the order doesn't matter, and divide the rest in half, you should be left with the number of possible tickets.

7
On

You are effectively asking for a formula to calculate the number of unordered pairs $\{ a, b \}$ from a set of $n$ numbers. Because if $a \neq b$, then either the ordered pair $( a, b )$ or the ordered pair $(b, a)$ is guaranteed to qualify as a valid ticket (meaning that we could just count $\{a , b \}$), and if $a = b$, then $\{a, b\}$ also represents a valid ticket.

So this is in fact a combinatorial question whose answer is the binomial coefficient $\binom{n+1}{2}$. The $+1$ is there because every element can also be paired with itself in your problem, while this is not included in the definition of the binomial coefficient.

An argument like azimut's is in my opinion more convincing with respect to correctness, but I thought this answer might help you realise how the problem relates back to combinatorics.