An optimized all-optical "NAND" logic gate is studied analytically. The particular characteristic of this logic gate is that it is based on photonic crystals, it consists of a resonator coupled with two waveguides on a silicon substrate. The operating wavelength is equal to 1.55µm which represents the telecommunication wavelength, the switching power of the optical logic gate studied is 1.693 kw /µm2 its response is independent of the response of the resonator when the power intensity of the optical waves is lower than the resonance wavelength, the light will be coupled in the waveguides, in the opposite case the light propagates in the waveguide of the bus.