With random inputs, certain decision problems undergo a “phase transition”. We prove similar behavior in an optimization context. Given a conjunctive normal form (CNF) formula F on n variables and with m k-variable clauses, denote by max F the maximum number of clauses satisfiable by a single assignment of the variables. (Thus the decision problem k-sat is to determine if max F is equal to m.) With the formula F chosen at random, the expectation of max F is trivially bounded by 3 4 m E max F m. We prove that for random formulas with m = cn clauses: for constants c < 1, E max F is cn − Θ(1/n); for large c, it approaches (3 4 c + Θ( √ c))n; and in the “window” c = 1 + Θ(n−1/3 ), it is cn − Θ(1). Our full results are more detailed, but this already shows that the optimization problem max 2-sat undergoes a phase transition just as the 2-sat decision problem