The optimal design of thin-walled I beams so as to extremize the natural frequency of torsional vibration is considered. It is assumed that only one dimension of the cross-section, except for the web height, may be variable in given limits, along the axis of the beam. The optimality condition for the variable dimension is settled by means of Pontryagin's maximum principle. The effect of the constant, axial loads is also included. the solution of the problem formulated is generally found in an iterative way. Some numerical examples of optimization of the I beam with variable widt of flanges are given.