TITLE: Maximum number of edges in a bipartite graph
QUESTION [12 upvotes]: Prove that for a bipartite graph $G$ on $n$ vertices the number of edges in $G$ is at most $\frac{n^2}{4}$.  

I used induction on $n$.  
Induction hypothesis: Suppose for a bipartite graph with less than $n$ vertices the result holds true.  
Now take a bipartite graph on $n$ vertices.Let $x,y$ be two vertices in $G$ where an edge exist between $x$ and $y$. Now remove these two vertices from $G$ and consider this graph $G'$. $G'$ has at most ${(n-2)^2}\over4$. Add these two vertices back.  Then the number of edges $G$ can have is at most  
$$|E(G')|+d(x)+d(y)-1$$ 
My question is in my proof I took $d(x) + d(y) \le n$, where $d(x)$ denotes the degree of vertex $x$.  Can I consider $d(x)+d(y) \leq n$? I thought the maximum number of edges is obtained at the situation $K_{\frac n 2,\frac n 2}$

REPLY [3 votes]: Suppose $p,q$ are nonnegative integers with $p+q=n,$ and that $K_{p,q}$ has the maximum number of edges among all bipartite graphs with $n$ vertices.
If we move one vertex from the side with $p$ vertices to the side with $q$ vertices, we lose $q$ edges and gain $p-1$ new edges. Since the number of edges was already maximized, we must have $p-1\le q,$  that is, $p-q\le1.$ Symmetrically, we also have $q-p\le1,$ and so $|p-q|\le1.$
If $n$ is even, then from $p+q=n$ and $|p-q|\le1$ it follows that $p=q=\frac n2,$ and $pq=\frac{n^2}4=\left\lfloor\frac{n^2}4\right\rfloor.$
If $n$ is odd, then $\{p,q\}=\left\{\frac{n-1}2,\frac{n+1}2\right\},$ and $pq=\frac{n^2-1}4=\left\lfloor\frac{n^2}4\right\rfloor.$