K. Kraft and S. Larsson, The dual weighted residuals approach to optimal control of ordinary differential equations, preprint 2008:2, Department of Mathematical Sciences, Chalmers University of Technology Abstract. The methodology of dual weighted residuals is applied to an optimal control problem for ordinary differential equations. The differential equations are discretised by finite element methods. An {\apost} error estimate is derived and an adaptive algorithm is formulated. The algorithm is implemented in Matlab and tested on a simple model problem from vehicle dynamics.