You won't get confused if you know the proofs of all these theorems and how all these theorems are connected.
First of all, see that -
- If a graph is connected then $e≥n−1$.
- If a graph has more than $\frac{(n−1)(n−2)}{2}$ then it is connected.
Both the theorems are different.
Notice that the implications in 1 and 2 are in opposite directions.
The $1^{st}theorem$ says about how few edges can you use to connect all the vertices- (this is the case when your graph does not contain any cycle ) while $2^{nd}theorem$ says that you cannot construct an undirected disconnected graph with $\frac{(n−1)(n−2)}{2}+1$ edges.
3. A graph with n vertices and p connected components contains at least
n-p edges.
Proof -
Let $1^{st}$ component contains $n_1$ vertices, $2^{nd}$ component contains $n_2$ vertices .. $p^{th}$ component contains $n_p$ vertices
Using theorem 1- $i^{th}$ component must contain a minimum of $n_i - 1$ edges to be connected.
So minimum number of edges in a graph $G$ with n vertices and p connected components $\Rightarrow$
$n_1-1+n_2-1+n_3-1+......n_p-1 $
$\Rightarrow$ = {$\underset{n}{\underbrace{n_1+n_2+n_3....n_p}}- $($ \underset{P times}{\underbrace{1+1+1.....+1}}$)}
$\Rightarrow$ $n-p$
4. In a simple graph with n vertices and p connected components, there are at most
$\frac{(n-p)(n-p+1)}{2}$ number of edges -
Proof-
If you have a connected component with $x$ nodes in it, the maximum number of edges you can have in that connected component is $\frac{x(x - 1)}{2}$. Therefore, if you have $n$ total nodes and $p$ different connected components, you can imagine distributing the nodes into the connected components in a way that maximizes the sum of $\frac{x(x - 1)}{2}$ across the connected components.
This is maximized when $p - 1$ of the connected components have 1 node and the last connected component has $n - p + 1$ nodes in it.
So under this setup, the maximum number of possible edges in the $p - 1$ singleton Components will be 0 and the maximum number of possible edges in the last Component will be $\frac{(n-p)(n-p+1)}{2}$ .
Therefore, In a simple graph with n vertices and p connected components, there is at
most
$\frac{(n-p)(n-p+1)}{2}$ edges%.
5. If each component contains an equal number of edges then the maximum
number of edges that graph can have-
$\frac{n(n - p)}{2p}$
Proof -
Let there are p connected components and each component contains x vertices-
The maximum number of edges you can have in a single connected component is $\frac{x(x - 1)}{2}$.
So maximum number of edges that graph G contains $p*\frac{x(x - 1)}{2}$ .
$\frac{n(x - 1)}{2}$ . $//px=n$
Divide both numerator and denominator by p. We will get -
$\frac{n(n - p)}{2p}$
Now, Coming to your question-
In the question n = 10 and p = 5
so $\frac{10(10 - 5)}{2*5} = 5$