function of differentiator in op-amp
for an ideal opamp in negative feedback the voltage at the virtual ground node on the positive terminal is equal to the voltage at the virtual ground node on the negative terminal. assume virtual ground node is at 0V. therefore, voltage between output node to ground is equal to voltage between output node to virtual ground = voltage across the feedback capacitor(Vc). Vc is integral of the current through it (as a consequence of electrostatic theory). the current throught the capacitor is = current through resistor = Vin/R. hence the Vc = Vout is an integral of Vin with some proportionality constant.
if the capacitor is in the input and resistor in the feedback, the input current = Ic = CdVin/dt. this flows through resistor, hence a differentiator.