Dynamic state feedback and its application to linear optimal control