How many ways to create and select 2 lines from a set of 5 points

57 Views Asked by At

We have 5 points: A, B, C, D, E

Any two unique points define a line.

How many ways can we select two unique lines?

example) AB-AC form a set of 2 lines. AB-AD, AB-AE, AB-BC, AB-BD, etc.

I tried brute force counting, and I got 40. However, I was expecting that answer to match a calculated answer of: $$L={{5}\choose{2}} $$ where $L$ is the number of possible lines. $$N=.{{L}\choose{2}}$$ where $N$ is the possible ways we can select a pair of lines that can be defined by the 5 points. But, a quick evaluation gives 45 instead of 40. Possible that I messed up somewhere along the brute force method, but I want to verify that the equations above are correct for solving this problem so that I can generalize this to a larger set of points.

Thanks!

EDIT: No 3 points are co-linear

EDIT: Here are the 40 combos that I found. I have not found my error yet, but would like to so i can fix my for loop

1:2 - 1:3

1:2 - 1:4

1:2 - 1:5

1:2 - 2:3

1:2 - 2:4

1:2 - 2:5

1:2 - 3:4

1:2 - 3:5

1:2 - 4:5

1:3 - 1:4

1:3 - 1:5

1:3 - 2:3

1:3 - 2:4

1:3 - 2:5

1:3 - 3:4

1:3 - 3:5

1:3 - 4:5

1:4 - 1:5

1:4 - 2:4

1:4 - 2:5

1:4 - 3:4

1:4 - 3:5

1:4 - 4:5

1:5 - 2:5

1:5 - 3:5

1:5 - 4:5

2:3 - 2:4

2:3 - 2:5

2:3 - 3:4

2:3 - 3:5

2:3 - 4:5

2:4 - 2:5

2:4 - 3:4

2:4 - 3:5

2:4 - 4:5

2:5 - 3:5

2:5 - 4:5

3:4 - 3:5

3:4 - 4:5

3:5 - 4:5

1

There are 1 best solutions below

3
On BEST ANSWER

Yes, your calculation is correct: There are

$${5\choose 2} = 10$$ lines, and so there are

$${10\choose 2} = 45$$ pairs of lines.

So you must have missed some when doing this by brute force.

And yes, this clearly generalizes for $n$ points:

$${n\choose 2} = \frac{n(n-1)}{2}$$ lines and thus

$${{\frac{n(n-1)}{2}}\choose 2} = \frac{\frac{n(n-1)}{2}\cdot(\frac{n(n-1)}{2}-1)}{2}= \frac{n^2(n-1)^2}{8} - \frac{n(n-1)}{4}$$ pairs