I know that a similar exercice was already posted on this website but I would like to have a piece of advice concerning the method/way of thinking I used to solve this problem. I don't know if I can do this here or if I have to write in the comment of the exercice that was posted. Pardon in advance.
We have to prove a statement $p \Rightarrow q.$ So as to do so I wanted to prove $\neg q \Rightarrow \neg p.$
To solve this problem I first considered that with a graph with $n$ vertices the maximum value of edges that we can get is when we consider the graph as a complete graph . But we have to deal with a disconnected graph. To obtain the maximal value of edges, I split the set of vertices into two partitions $X$ and $Y$ such that $Y$ = {v} where v $\in$ $V$. This would mean that $|X| = |V|-1.$
Now, I compute the maximum number of edges that I can obtain from the graph $X: \binom{|V| -1}{2}$. As it corresponds to the maximal value of edges that we can obtain (by respecting the conditions of the statement), it means that $|E| \leq \binom{|V| -1}{2}$.
Ps: I only removed one vertex because: the more I remove vertices, the less edges I will obtain.
Thank you in advance for your comments.
If the graph is not connected, then we can write $V=X\cup Y$ where $X,Y$ are non-empty and disjoint and there is no edge between vertices in $X$ and vertices in $Y$. While you are right that ultimately the numerically "worst case" does happen when $Y$ (or $X$) has only one element, you cannot assume in your proof that the sets do have this property to begin with. The structure and size of possible $X,Y$ is iven by the (given, arbitrary) graph and for a concrete graph may exclude that one of them has only one element. So in your proof, you will at some step have to show ${k\choose 2}+{n-k\choose 2}\le{n-1\choose 2}$ for all $k$ with $1\le k\le n-1$.