3

If I take the following integral:

$$\int_0^l \sin\left(\frac{n\pi x}{l}\right)\sin\left(\frac{m\pi x}{l}\right)\mathrm dx, \tag{1}$$

and I put it into an integral calculator, it produces the following formula:

$$y=-\frac{l((n-m)\sin(\pi n+\pi m)+(-n-m)\sin(\pi n-\pi m))}{2\pi (n^2-m^2)}. \tag{2}$$

If I then calculate $y$ for various combinations of integer $n$ and $m$ I find that when $n\neq m$ then $y=0$ and when $n=m$ then $y=\text{undefined}$. However if I set $n=m$ with $n,m\in \Bbb N$ in $(1)$ I find that I get a finite answer when $n=m$.

What's strange is that if I consider both formulas to be $y(n,m)$, even though they are equivalent (?), one is undefined at $y(m,m)$ and the other is finite. What is going on here?

FWIW: I am a physicist(-type background), not mathematics, I don't have a thorough understanding of how integrals are constructed.

Charlie
  • 685
  • When $n=m$, both the numerator and denominator are zero. I don't really have the energy to look at this in detail right now, but remember that $\sin(\theta) \approx \theta$ when $\theta$ is close to zero. As such, the numerator has a factor of (approximately) $n-m$, which kills off the $n-m$ in the denominator (because $n^2 - m^2 = (n-m)(n+m)$). Take a limit to more better see what is going on. – Xander Henderson Jan 27 '22 at 21:41

2 Answers2

4

In fact

$$y(m,n)=-\frac{(l((n-m)\sin(\pi n+\pi m)+(-n-m)\sin(\pi n-\pi m)))}{2\pi (n^2-m^2)}$$ can be extended by continuity if $m \to n$. This should be the value you get for $m=n$ and indeed

$$\lim\limits_{m \to n} y(m,n) = \frac{l}{2}.$$

2

If you use $$\cos(a-b)-\cos(a+b)=2\sin(a)\sin(b)$$ $$J=2\int \sin\left(\frac{n\pi x}{L}\right)\sin\left(\frac{m\pi x}{L}\right)\,dx=\int \cos \left(\frac{\pi x (m-n)}{L}\right)\,dx-\int \cos \left(\frac{\pi x (m+n)}{L}\right)\,dx$$ $$J=\frac{L }{\pi (m-n)}\sin \left(\frac{\pi x (m-n)}{L}\right)-\frac{L }{\pi (m+n)}\sin \left(\frac{\pi x (m+n)}{L}\right)$$ $$K=\int_0^L \sin\left(\frac{n\pi x}{L}\right)\sin\left(\frac{m\pi x}{L}\right)\,dx=\frac L {2} \Bigg[\frac{\sin (\pi (m-n))}{\pi(m-n)}-\frac{\sin (\pi (m+n))}{\pi(m+n)} \Bigg]$$ If $m$ and $n$ are integers of the same sign, the second sine is $0$ and we need to consider $$\frac L 2 \frac{\sin (\pi (m-n))}{\pi(m-n)} \quad \to \quad \frac L 2\quad \text{if} \quad m\to n$$