I was looking at another answer on this stack exchange
"An alternate proof strategy: if $G$ is the disconnected union of a $k$ -vertex graph and an $(n−k)$ -vertex graph, then it has at most $\binom{k}{2}$ + $\binom{n−k}{2}$ edges; this is maximized when $k=1$ or $k=n−1$ , in which case the bound on the number of edges is $(n−1)(n−2)2$"
and I know it truly is maximized when $k=1$ or $k=n-1$ but I was hoping to get an analytical or combinatorial proof as to why? .
The function $f(k):={k\choose 2}+{n-k\choose 2}$ is quadratic in $k$. It's a parabola opening up, with vertex at $k=\frac n2$. You can see this by expanding out the binomial coefficients and then taking a derivative (or completing the square). So $f(k)$ is maximized when $k$ is farthest from $\frac n2$. Since we exclude the degenerate cases $k=0$ and $k=n$, the maximum occurs at the next furthest values $k=1$ and $k=n-1$. You can check that these two values for $k$ are equidistant from $\frac n2$.