0

I'm working through a book (Fourier Series) by Georgi P. Tolstov and I cannot figure out what method the author uses to solve the following problem. I solved it using integration by parts, but the specific form of the author's answer is useful (I got $-4n$, which I confirmed using Wolfram Alpha). But the author gives the solution as $(-1)^n \frac{4}{n^2}$, which is a form more useful for Fourier analysis. But I cannot follow the steps involved:

$a_n = \frac{2}{\pi} \int_0^{\pi} x^2 \cos nx \ dx$

= $- \frac{4}{\pi n} \int_0^{\pi} x \sin nx \ dx$

= $\frac{4}{\pi n^2} \lbrack x \cos nx \rbrack_{x=0}^{x=\pi} - \frac{4}{\pi n^2} \int_0^{\pi} \cos nx \ dx$

=$\frac{4}{n^2} \cos n\pi$

= $(-1)^n \frac{4}{n^2}$

Any direction (especially step by step) would be greatly appreciated.

  • Since the author uses integration by parts and Wolfram agrees with the authors result it is perhaps best that you include your calculations as well. – Manifoldski Dec 08 '22 at 23:12
  • You say "I got $-4n$" but for which integral ? One thing is sure, the author uses a double integration by parts. – Jean Marie Dec 08 '22 at 23:16
  • In the first integration-by-parts, the $ \ x^2 \sin(nx) \ $ term is zero at both endpoints; in the second, the integral $ \ \frac{4}{\pi n^2} \ \int_0^{\pi} \cos nx \ \ dx \ $ is zero since $ \ n \ $ is an integer. Only the first term on the third line "survives". I'm afraid I don't see how you are getting $ \ -4n \ \ . $ –  Dec 08 '22 at 23:34
  • @Manifoldski - It's possible that my solution is wrong, but I still don't see how the author got their result. For reference, here is the solution I worked (https://www.wolframalpha.com/input?i2d=true&i=Divide%5B2n%2Cπ%5D+*+integrate+Power%5Bx%2C2%5D++cos+x+dx+from+x%3D0+to+pi) . – Christopher Cavnor Dec 09 '22 at 01:25
  • @boojum - I think that I follow that. At least it gives me insight. Thank you. – Christopher Cavnor Dec 09 '22 at 01:44
  • Yes, now I see how you got your result, but you should be integrating $x^2 \cos(nx)$ not $x^2\cos(x)$ – Manifoldski Dec 09 '22 at 15:01
  • For your calculations It seems like you assume that $\cos(nx) = n \cos(x)$ which is not correct, $\cos(nx)$ is never bigger than $1$ but $n\cos(x)$ surely can be – Manifoldski Dec 09 '22 at 15:09
  • @Manifoldski Thanks for that clarification. I was treating n as a constant. – Christopher Cavnor Dec 09 '22 at 18:39
  • And I see why I wasn't seeing what you were doing with WolframAlpha: apparently, posting links in comments only run a maximum number of characters in the URL, so just clicking on your link only shows $ \ \frac{2 \pi}{n} \ $ in the WA window on the other end. When I copypasted your full URL to another window, I saw the integral you were running. In general, $ \ \cos(nx) \ \neq \ n \cos(x) \ \ . $ –  Dec 09 '22 at 19:42

1 Answers1

0

Something to keep in mind with Fourier coefficient calculation is that $ \ n \ $ is taken to be an integer, so we will have the values $$ \sin(n \pi) \ \ = \ \ 0 \ \ \ , \ \ \ \cos(n \pi) \ \ = \ \ \left\{ \ \begin{array}{rcl} 1 \ \ , & \mbox{for} & n \ \ \text{even} \\ -1 \ \ , & \mbox{for} & n \ \ \text{odd} \end{array}\right. \ \ = \ \ (-1)^n \ \ . $$

To clarify what is going on with the integrations,

$$ a_n \ \ = \ \ \frac{2}{\pi} \int_0^{\pi} x^2 \cos (nx) \ \ dx $$ $$ = \ \ \frac{2}{\pi} \ \left( \ \left[ \ x^2 \ · \ \frac{1}{n} \ \sin(nx) \ \right]|_0^{\pi} \ \ - \ \ \int_0^{\pi} \ \frac{1}{n} \ · \ 2x \ \sin (nx) \ \ dx \ \right) \ \ ; $$ evaluating the term in brackets at either endpoint gives zero, leading to

$$ = \ \ - \frac{4}{\pi n} \int_0^{\pi} \ x \sin nx \ dx $$ $$ = \ \ - \frac{4}{\pi n} \ \left( \ \left[ \ x \ · \ \left(-\frac{1}{n} \ \cos(nx) \right) \ \right]|_0^{\pi} \ \ - \ \ \int_0^{\pi} \ -\frac{1}{n}· \cos (nx) \ \ dx \ \right) \ \ . $$

The new integral produces $ \ -\frac{1}{n} · \frac{1}{n} · \sin(nx) \ |_0^{\pi} \ \ , \ $ which equals zero at both endpoints. This leaves us with

$$ a_n \ \ = \ \ - \frac{4}{\pi n} \ · \ \left(-\frac{1}{n} \right) \ · \ \left[ \ \pi \cos (n \pi) \ - \ 0 · \cos (0) \ \right] \ \ = \ \ \frac{4}{n^2} \ \cos (n \pi) \ \ , $$

the evaluation of which is completed using the information at the start.

Fun fact: this particular Fourier series can be connected to the solution of the famous "Basel problem" (though is certainly not the way Euler solved it).