If f extremizes the functional subject to the boundary conditions, then any slight perturbation of f that preserves the boundary values must either increase J (if f is a minimizer) or decrease J (if f is a maximizer).