Maximum number of edges in a complete graph = nC2
Since we have to find a disconnected graph with maximum number of edges with n vertices. Therefore our disconnected graph will have only two partions because as number of partition increases number of edges will decrease.
Now assume that First partition has x vertices and second partition has (n-x) vertices.
total number of edges = xC2 +(n-x)C2
=1/2*(2x2 -2nx + n2 -n), where , 1<= x <= n-1
It would be maximum at both extreme(at x=1 or x= n-1).
Therefore, total number of edges = nC2 - (n-1) = n-1C2