The formation of autonomous mobile robots to an arbitrary geometric pattern in a distributed fashion is a fundamental problem in formation control. This paper presents a new asynchronous, memoryless (oblivious) algorithm to the formation problem via distributed optimization techniques. The optimization minimizes an appropriately defined difference function between the current robot distribution and the target geometric pattern. The optimization processes are performed independently by individual robots in their local coordinate systems. A movement strategy derived from the results of the distributed optimizations guarantees that every movement makes the current robot configuration approaches the target geometric pattern until the final pattern is reached.