The infinite-horizon optimal control problem with stability in the presence of single-input, inputquadratic nonlinear systems is addressed and tackled in this paper. In addition, it is shown that similar ideas can be extended to study the property of passivity of the underlying input-quadratic system from a given output. The constructive design of the optimal solution revolves around the interesting fact that the property of optimality of the closed-loop underlying system is shown to be locally equivalent to the property that an input-affine system possesses an L 2-gain less than one from a virtual disturbance signal. The global version of the statement requires a technical condition on the graph of the storage function of the latter auxiliary plant, hence leads to the new notion of graphical storage function. Finally, the theory is corroborated by the application to the optimal control of the movable plane positioning in micro-mechanical systems (MEMS) actuators.