For each vertex triple , let indicate that its three edges are present. Then and
Each variance is . Two distinct triples have independent indicators unless they share an edge; in that case their covariance is . There are unordered pairs sharing an edge. Therefore the triangle count in a binomial random graph has
If , Markov inequality gives . If , then and
The second term tends to zero since . Chebyshev inequality now gives , proving the stated threshold. Here the random-graph phrase “almost surely” means asymptotically almost surely, that is, with probability tending to one.
At , let count edges. Direct subtraction gives
Some graph has at least this expectation. Successively deleting one edge from each remaining triangle destroys all triangles with at most deletions, so a triangle-free graph remains with at least edges. This triangle deletion in the alteration method proves the requested existence bound.
It is not within a constant factor of the optimum. A balanced complete bipartite graph has edges and no triangle. Conversely, in a triangle-free graph each edge satisfies . Summing over edges gives , where is its edge count. Cauchy-Schwarz inequality gives , hence . The optimum is therefore , quadratic rather than the obtained bound.