There is a subtle difference between a local extrema and the global extrema. The global maximum is the largest value attained by a function in its domain, on the other hand, local maximum is a largest value attained by a function in some neighborhood.