This is an Exercise 1.1.4. from Yufei Zhao's book Graph Theory and Additive Combinatorics.
Prove that every $n$-vertex non-bipartite triangle-free graph has at most $(n-1)^2/4+1$ edges.
My approach: Suppose that $v$ is a vertex of maximal degree. Consider $A:=N(v)$, then $A$ is an independent set since $G$ is triangle-free graph. Let $B:=V\setminus A$, then $A,B$ is a partition of $V$. Since $G$ is a non-bipartite graph, then there is an edge $\tilde{e}=b_1b_2$, where $b_1,b_2\in B$.
Hence $$e(G)-1\leq \sum \limits_{x\in B\setminus\{b_1,b_2\}} \deg(x)+(\deg(b_1)-1)+(\deg(b_2)-1).$$ $$e(G)\leq \sum \limits_{x\in B\setminus\{b_1,b_2\}} \deg(x)+(\deg(b_1)+\deg(b_2))-1.$$ Since $b_1b_2$ is an edge, then $\deg(b_1)+\deg(b_2)\leq n$. Hence $$e(G)\leq |A|(|B|-2)+n-1,$$ where $|A|+|B|=n$. Hence $e(G)\leq |A||B|-|A|+|B|-1\Rightarrow$ $$e(G)\leq (|B|-1)(|A|+1).$$
But it does not imply the inequality which I need to prove. I guess that I am not using the condition that $G$ is non-bipartite fully.
