In complete graph, how can I prove ${n\choose 2} = {k\choose 2} + k(n-k) + {n-k\choose 2}$ for $0 \le k \le n$

1.5k Views Asked by At

I'm studying graphs in algorithm and complexity, but I'm not very good at math. How can I prove that ${n\choose 2} = {k\choose 2} + k(n-k) + {n-k\choose 2}$ for $0 \le k \le n$?

2

There are 2 best solutions below

1
On BEST ANSWER

Hint: Consider a complete graph on $n$ vertices and partition its vertex set in two subsets, one with $k$ and one with $n-k$ elements. How many edges does the graph have in total? How many are there within each of the two subsets? Can you finish off the argument?

0
On

Let $\{1,\ldots,n\}$ be partitioned into two sets $A$ and $B$, where $A=\{1,\ldots,k\}$ and $B = \{k+1,\ldots,n\}$. In how many ways can we choose two elements from $\{1,\ldots,n\}$? There are three possibilities: both elements are from $A$ (the two elements can be chosen in ${k \choose 2}$ ways), both elements are from $B$, or one element is from $A$ and the other element is from $B$.