Mechanisms generating patterns in spatial domains have been extensively studied in biology, but also in economics in the context of new economic geography. The Turing mechanism or Turing diffusion-induced instability has been central to the understanding of forces which endogenously generate spatial patterns, but in a context where agents do not explicitly optimize an objective. The present paper reviews tools to study, in the spirit of Turing's analysis, a mechanism generating optimal diffusion-induced instability where optimizing agents generate optimal agglomerations. By extending the maximum principle to the optimal control of partial differential equations, it is shown how under certain conditions it will be optimal to design controls so that the price-quantity system implied by the costate–state functions of the optimal control of distributed parameter systems induces optimal spatial patterns. These methods might be useful in studying pattern formation both in problems of resource management and of economic development.