Infinite well particle probability where it will most likely be found Suppose a particle is in the first excited state of an infinite square well of width $L$, where would the particle most likely be found if its position were measured?

So by looking at the probability density graph I can see that the particle will be most likely be found in between $\frac{L}{4}$ and $\frac{3L}{4}$ but is there a more specific computational way to found out instead of referring to the probability density graph? For example, if I want to know where a particle is most likely to be found for the second excited state then I can refer to the graph again and see that it will be most likely in between $\frac{L}{8}$ and $\frac{7L}{8}$  but what if I wanted to find the $50th$ excited state then looking at the graph will be complicated.

I know that the probability density is $$|\Psi(x)|^2=\frac{2}{L}\sin^2(\frac{n\pi x}{L}), \text{where $n$ is the particle's state}$$
but how do I use that to determine where the particle will most likely be found?
 A: If we have a discrete set of values for some quantity that we can measure $x$, then the average of those values can be expressed in terms of the probability of obtaining a particular value of $x$
$$\bar{x}=\sum_{i=1}^{N}P(x_i)x_i,\qquad\qquad\qquad(1.1)$$
where $\bar{x}$ represents the average value, $N$ the number of measurements, and $P(x_i)$ the probability of measuring $x_i$. Now in your case, the wavefunction corresponds to a probability density amplitude the squared modulus of which is a probability density, which simply means $P(x_i)=|\Psi(x_i)|^2\Delta x$, such that $P(x_i)$ corresponds to the probability of finding a particle within a bin centred at $x_i$ and having a range $\Delta x$. Substituting $P(x_i)$ back into Eq.(1.1) and allowing $N\to\infty$, $x_i\to x$ and $\Delta x \to dx$ the summation turns into an integration and we find
$$\langle x\rangle = \frac{2}{L}\int_{0}^{L}x\sin^2\left(\frac{n\pi x}{L}\right)dx,\qquad\qquad\qquad(1.2)$$
where for the limit $N\to\infty$ we obtain the expectation of x, $\bar{x}_{N\to\infty}=\langle x\rangle$. I will let you do the integral Eq.(1.2).
A: The particle is most likely to be found where the probability density is largest. So, find where the the probability density function is maximized using standard calculus methods.
