TITLE: How to prove that for any graph on $8$ nodes with exactly $17$ edges has at least $4$ triangles.
QUESTION [5 upvotes]: Question:
for any graph on $8$ nodes  with exactly $17$ edges has at least $4$ triangles.

 for example,  This picture at least 4 triangles
from this : I found this reslut:
for any graph on $2n+\delta$ nodes(where $\delta$ is $0$ or $1$) with exactly $n(n + \delta) + 1$ edges has at least $n$ triangles.
see:
Graph with 10 nodes and 26 edges must have at least 5 triangles
But I couldn't find the proof of this. Can anyone help me prove it? 
Thank you

REPLY [14 votes]: For a graph $G$, a subgraph $H$ of $G$, and a vertex $v$ in $H$, let $\deg_H(v)$ denote the degree of $v$ in $H$.
For a positive integer $n$ and $\delta\in\{0,1\}$, let $P(n,\delta)$ denote the statement "any (simple) graph on $2n+\delta$ vertices and exactly $n(n+\delta)+1$ edges has at least $n$ triangles."
As Aryabhata's answer in your link indicated, you can proceed by induction on $(n,\delta)$, where the base case is $P(1,1)$ which is clearly true. (The statement $P(1,0)$ is vacuously true, too.) 

Lemma: For $n\geq 2$ and $\delta\in\{0,1\}$, any simple graph with $2n+\delta$ vertices and exactly $n(n+\delta)+1$ edges  has a vertex of degree at most $n$.
Proof: Otherwise, all vertices have degree at least $n+1$ and apply the Handshaking Lemma to obtain a contradiction.

Now to prove $P(n,\delta)$ is true for $n\geq 2$, let $G$ be a graph with $2n+\delta$ vertices and exactly $n(n+\delta)+1$ edges. We consider two cases.
Case 1: $\delta=1$ and we assume $P(n,0)$ is true.
Let $v$ be a vertex with $\deg_G(v)\leq n$ and consider $G-v$. This is a simple graph on $2n$ vertices with $$n(n+1)+1-\deg(v)\geq n(n+1)+1-n = n(n+0)+1$$ edges. Thus we may delete edges from $G-v$ until we have a graph $G^\prime$ with $2n$ vertices and exactly $n(n+0)+1$ edges. Then $G^\prime$ has at least $n$ triangles since $P(n,0)$ is true. Each triangle of $G^\prime$ is a triangle in $G$, so $G$ has at least $n$ triangles as well. Hence $P(n,1)$ is true.
Case 2: $\delta=0$ and we assume $P(n-1,1)$ is true.
Again, let $v$ be a vertex with $\deg_G(v)\leq n$ and consider $G-v$. This is a simple graph on $2n-1=2(n-1)+1$ vertices with $$n(n)+1-\deg(v) \geq n(n)+1-n = (n-1)(n-1+1)+1$$ edges and so, deleting edges if necessary, $G-v$ has at least $n-1\geq 1$ triangles because $P(n-1,1)$ is true. However... 
Subcase (2a): $\deg_G(v)<n.$
In this case, $G-v$ has strictly more than $(n-1)(n-1+1)+1$ edges. Therefore, when we delete edges from $G-v$ in order to apply $P(n-1,1)$ we can do so in such a way that at least one of these deleted edges is an edge in a triangle in $G-v$. This gives a new graph $G^\prime\neq G-v$ still satisfying the hypotheses of $P(n-1,1)$ so that $G^\prime$ has at least $n-1$ triangles. But since we broke at least one triangle from $G-v$ to get $G^\prime$, this means we must have had at least $n$ triangles in $G-v$ and hence in $G$.
Subcase (2b): $\deg_G(v)=n.$
In this case $G-v$ has $2n-1$ vertices and $n(n-1)+1$ edges. Let $A$ be the $n$ neighbours of $v$ in $G-v$ and let $B$ be the other $n-1$ vertices in $G-v$. 
If there exists $x,y\in A$ that are adjacent then $\{x,y,v\}$ is a triangle $G$ that is not in $G-v$ and so we may conclude that $G$ has at least $n-1+1= n$ triangles. 
So suppose $A$ forms an independent set. Then for all $x\in A$, $\deg_{G-v}(x)\leq n-1$. If there is a vertex $x\in A$ with $\deg_{G-v}(x)\leq n-2$, then $\deg_G(x)\leq n-1$ and so we can replace $v$ with $x$ in Subcase (2a) to show that $G$ has at least $n$ triangles.
Therefore we may assume that for all $x\in A$, $\deg_{G-v}(x)=n-1$. Then $A,B$ and the edges between them is isomorphic to $K_{n,n-1}$. However this gives only $n(n-1)$ edges of $G-v$ and hence there is an edge $e=(b,c)$ between two vertices $b,c\in B$. But then $\{b,c,x\}$ is a triangle for each of the $n$ vertices $x\in A$, giving $n$ triangles in $G-v$ and hence in $G$.