We propose a new compact optical switch that works over a wide wavelength band. This switch has low cross talk and can be easily integrated with other components of the communication system. The device utilizes the self imaging theory of the parabolic index profile. A new methodology to formulate the design problem as an optimization problem is proposed. Both the response and the gradient of the response are utilized within a gradient-based optimization approach. The adjoint variable method is utilized to extract the gradient of the response using the wide angle BPM method.