A new approach to perform analog optical differentiation is presented using half-wavelength slabs. First, a half-wavelength dielectric slab is used to design a first order differentiator. The latter works properly for both major polarizations, in contrast to designs based on Brewster effect [Opt. Lett. 41, 3467 (2016)]. Inspired by the proposed dielectric differentiator, and by exploiting the unique features of graphene, we further design and demonstrate a reconfigurable and highly miniaturized differentiator using a half-wavelength plasmonic graphene film. To the best of our knowledge, our proposed graphene-based differentiator is even smaller than the most compact differentiator presented so far [Opt. Lett. 40, 5239 (2015)].