When is maximising a definite integral the same as maximising the integrand? When is maximising
$$\int_a^b f(x) \text{d}x$$
the same as maximising $f(x)$?
Context: I was trying to find the most probable location of an electron in the ground state hydrogen atom, where the wavefunction is $\text{exp}(-r/a_0)$, and hence the probability density is $\text{exp}(-2r/a_0)$. The probability is therefore proportional to
$$\iiint e^{-\frac{2r}{a_0}}\text{d}^3{\bf r}.$$
Since in spherical coordinates, the volume of a spherical shell is $4\pi r^2 \text{d}r$, I am told that to maximise the probability, I should maximise $r^2 \text{exp}(-2r/a_0)$. However, I seem to be maximising the integrand, not the integral, here. If $\text{d}P \propto r^2 \text{exp}(-2r/a_0) \text{d}r$, is $\text{d}P/\text{d}r$ not just $r^2 \text{exp}(-2r/a_0)$?

Think of the definite integral as giving you the area under the curve of $f(x)$ above the interval $[a,b]$. Suppose at all values on the interval, you had another function $g$ which is always more than $f$ (i.e. $g(x)\geq f(x)$ for all $x\in [a,b]$). The area under $g$ is obviously greater. Therefore, when the integrand is bigger, the integral is bigger, and vice versa. (Note that you run into trouble here if on the interval $f$ is sometimes greater than $g$ and sometimes smaller than $g$, I'm assuming we don't need to care about this issue here.)
