I'm working through an integral for Quantum Mechanics 2, Harmonic oscillator with time-dependent perturbation, and I have encountered this situation when evaluating the integral.
The part in question is
$$\frac{-\cos((2-n)\pi)}{2-n} + \frac {\cos 0}{2-n} + \text{uninteresting values}$$ It looks to me like I have $-\dfrac 1 0 + \dfrac 1 0$ , which is a bit dicey.
Excluding possible conditions from this issue, $n > 1$ is an integer. I want to include $n=2$ if possible, as the question is concerned with the probability of moving from the $n=1$ state to higher order states.
If this is "legal" then the integral would equal $0$ for even $n$ and have value for odd $n$. I desire to know if I can include $n=2$.
The original integral is:
$$\int_0^L \sin\left({\frac{n \pi x}{L}}\right)\sin^2\left({\frac{n \pi x}{L}}\right)\, \mathrm dx$$
I'm primarily physics, not math, so if I've used imprecise language please correct me!
For $n=2$ you can find that the antiderivative is $\frac{L}{24 \pi} \cos(6 \pi x/L) - \frac{3 L}{8 \pi} \cos(2 \pi x/L) + C$, so the integral between $0$ and $L$ is zero. This antiderivative comes from power reduction, and can also be derived using some tricks with complex exponentials. A different one is obtained if you do it how I was taught, which is to use $\sin(x)^3=\sin(x)-\sin(x)\cos(x)^2$. The result with a definite integral is of course the same.
Technically you can't directly infer this from what you wrote. A "quick and dirty" way would be to think of $n$ as a continuous parameter and calculate $\lim_{n \to 2} \frac{\cos(0) - \cos((2-n) \pi)}{2-n}$. You can view this as a L'Hospital's rule problem if you want, though it is actually just a derivative (maybe up to a minus sign). Either way, the numerator is on the order of $(2-n)^2$ as $n \to 2$, so the limit will indeed be zero.