First take a time derivative of a function describing motion,
.
Finding the maxima of the function is obtained by determining where the critical points are. You can find the critical points by equating the derivative with 0 and solving for t,
.
So at 2 seconds the ball peaks in height.
To find out the height feed 2 to the function h.
.
So at 2 seconds the ball reaches maximum height of 5 meters.
Hope this helps :)