a graph G with n vertices has more than k edges i need to find the minimum number satisfying the following condition:
if a  simple graph G with n vertices has more than k edges than G is connected.
 A: For each positive integer $n$, let $f(n)$ be the least nonnegative integer such that every simple undirected graph with exactly $n$ vertices and at least $f(n)$ edges is connected.

Clearly $f(1)=0$.

Claim:$\;$If $n > 1$, then$\;f(n)={\large{\binom{n-1}{2}}}+1$.

Proof:

Fix a positive integer $n > 1$.

Following Brian Scott's hint, choose a vertex of $K_n$, say $v$, and let $G$ be the subgraph of $K_n$ obtained by removing all edges which have $v$ as an endpoint.

Then $v$ has degree $0$ in $G$, so $G$ is not connected.

Noting that $G$ has exactly ${\large{\binom{n-1}{2}}}$ edges, it follows that$\;f(n) > {\large{\binom{n-1}{2}}}$.

Next let $G=(V,E)$ be any simple undirected graph such that $|V|=n$ and $|E| >  {\large{\binom{n-1}{2}}}$.

Our goal is to show $G$ is connected.

Suppose otherwise.

Then we can write $V=A\cup B$ where $A,B$ are disjoint, nonempty subsets of $V$ such that no edge of $G$ connects an element of $A$ with an element of $B$.

Let $a=|A|$ and let $b=|B|$.
\begin{align*}
\text{Then}\;\;|E|
&\le\binom{a}{2}+\binom{b}{2}\\[4pt]
&=\frac{a(a-1)}{2}+\frac{b(b-1)}{2}\\[4pt]
&=\frac{a(a-1)+b(b-1)}{2}\\[4pt]
&\le\frac{\Bigl(a(a-1)+(a-1)(b-1)\Bigr)+\Bigl(b(b-1)+(a-1)(b-1)\Bigr)}{2}\\[4pt]
&=\frac{\Bigl((a-1)(a+b-1)\Bigr)+\Bigl((b-1)(b+a-1)\Bigr)}{2}\\[4pt]
&=\frac{(a+b-1)(a+b-2)}{2}\\[4pt]
&=\frac{(n-1)(n-2)}{2}\\[4pt]
&=\binom{n-1}{2}\\[4pt]
\end{align*}
contradiction.

Hence $G$ is connected.

It follows that $\;f(n)={\large{\binom{n-1}{2}}}+1$.
