Extra factor of 2 when evaluating an infinite sum using fourier series and parseval's theorem.












1












$begingroup$


I'm asked to find the fourier series of the $2 pi $ periodic function f(x) which is $sin(x)$ between $0$ and $pi$ and $0$ between $pi$ and $2pi$



I use the complex form to proceed and get $$frac{1}{2pi}int_{0}^{pi}sin(x)e^{-ikx}dx$$. The complex coefficient $c_k$ I get as result is $frac{-1}{pi(k^2-1)}$ where $k=2n$ (k even) which is also correct according to WolframAlpha.



But then, I'm asked to use this result to evaluate $sum_{n=1}^{infty}frac{1}{(4n^2-1)^2}$. For that, I switch to the real coefficients using $a_k=c_k+c_{-k}, b_k=i(c_k-c_{-k})$. I get: $a_k=frac{-2}{pi(k^2-1)}, a_0=frac{2}{pi}$ and $b_k$ is $0$.



So $f(x)=frac{a_0}{2}+sum_{k=1}^{infty}a_kcos(kx)$



I then use Parseval's theorem to evaluate the sum we are looking for, remembering that k is even, i.e. $k=2n$ and that the function is $0$ between $pi$ and $2pi$:



$$frac{1}{pi}int_{0}^{2pi}|f(x)|^2 dx=frac{a_0^2}{2}+sum_{k=1}^{infty}a_k^2$$ (1)



$$frac{1}{pi}int_{0}^{pi}sin^2(x)dx=frac{frac{2^2}{pi^2}}{2}+sum_{n=1}^{infty}frac{4}{pi^2(4n^2-1)^2}$$ (2)
$$frac{1}{2}-frac{2}{pi^2}=sum_{n=1}^{infty}frac{4}{pi^2(4n^2-1)^2}$$ (3)



So finally I get$frac{pi^2}{8}-frac{1}{2}=sum_{n=1}^{infty}frac{1}{(4n^2-1)^2}$ (4)



However, WolframAlpha gets $frac{pi^2}{16}-frac{1}{2}$ so I must somehow have forgotten a factor of $frac{1}{2}$ or put an extra factor of $2$ by $frac{pi^2}{8}$.



Logically, this missing/extra factor must have happened while I was evaluating $frac{1}{pi}int_{0}^{pi}sin^2(x)dx$ because the $-frac{1}{2}$ at the end that came from the right side of the equality is correct according to WolframAlpha. But even when I evaluate $frac{1}{pi}int_{0}^{pi}sin^2(x)dx$ in WolframAlpha, I get the $frac{1}{2}$ from step (3) which finally becomes $frac{pi^2}{8}$ and again, an factor of $frac{1}{2}$ is missing, so I'm a bit perplex about what's wrong.



Thanks for your help !



Edit: the strange thing is that when I evaluate this sum using Parseval but with the fourier series of |sin(x)| between $0$ and $2pi$, I get the correct result.










share|cite|improve this question











$endgroup$

















    1












    $begingroup$


    I'm asked to find the fourier series of the $2 pi $ periodic function f(x) which is $sin(x)$ between $0$ and $pi$ and $0$ between $pi$ and $2pi$



    I use the complex form to proceed and get $$frac{1}{2pi}int_{0}^{pi}sin(x)e^{-ikx}dx$$. The complex coefficient $c_k$ I get as result is $frac{-1}{pi(k^2-1)}$ where $k=2n$ (k even) which is also correct according to WolframAlpha.



    But then, I'm asked to use this result to evaluate $sum_{n=1}^{infty}frac{1}{(4n^2-1)^2}$. For that, I switch to the real coefficients using $a_k=c_k+c_{-k}, b_k=i(c_k-c_{-k})$. I get: $a_k=frac{-2}{pi(k^2-1)}, a_0=frac{2}{pi}$ and $b_k$ is $0$.



    So $f(x)=frac{a_0}{2}+sum_{k=1}^{infty}a_kcos(kx)$



    I then use Parseval's theorem to evaluate the sum we are looking for, remembering that k is even, i.e. $k=2n$ and that the function is $0$ between $pi$ and $2pi$:



    $$frac{1}{pi}int_{0}^{2pi}|f(x)|^2 dx=frac{a_0^2}{2}+sum_{k=1}^{infty}a_k^2$$ (1)



    $$frac{1}{pi}int_{0}^{pi}sin^2(x)dx=frac{frac{2^2}{pi^2}}{2}+sum_{n=1}^{infty}frac{4}{pi^2(4n^2-1)^2}$$ (2)
    $$frac{1}{2}-frac{2}{pi^2}=sum_{n=1}^{infty}frac{4}{pi^2(4n^2-1)^2}$$ (3)



    So finally I get$frac{pi^2}{8}-frac{1}{2}=sum_{n=1}^{infty}frac{1}{(4n^2-1)^2}$ (4)



    However, WolframAlpha gets $frac{pi^2}{16}-frac{1}{2}$ so I must somehow have forgotten a factor of $frac{1}{2}$ or put an extra factor of $2$ by $frac{pi^2}{8}$.



    Logically, this missing/extra factor must have happened while I was evaluating $frac{1}{pi}int_{0}^{pi}sin^2(x)dx$ because the $-frac{1}{2}$ at the end that came from the right side of the equality is correct according to WolframAlpha. But even when I evaluate $frac{1}{pi}int_{0}^{pi}sin^2(x)dx$ in WolframAlpha, I get the $frac{1}{2}$ from step (3) which finally becomes $frac{pi^2}{8}$ and again, an factor of $frac{1}{2}$ is missing, so I'm a bit perplex about what's wrong.



    Thanks for your help !



    Edit: the strange thing is that when I evaluate this sum using Parseval but with the fourier series of |sin(x)| between $0$ and $2pi$, I get the correct result.










    share|cite|improve this question











    $endgroup$















      1












      1








      1


      1



      $begingroup$


      I'm asked to find the fourier series of the $2 pi $ periodic function f(x) which is $sin(x)$ between $0$ and $pi$ and $0$ between $pi$ and $2pi$



      I use the complex form to proceed and get $$frac{1}{2pi}int_{0}^{pi}sin(x)e^{-ikx}dx$$. The complex coefficient $c_k$ I get as result is $frac{-1}{pi(k^2-1)}$ where $k=2n$ (k even) which is also correct according to WolframAlpha.



      But then, I'm asked to use this result to evaluate $sum_{n=1}^{infty}frac{1}{(4n^2-1)^2}$. For that, I switch to the real coefficients using $a_k=c_k+c_{-k}, b_k=i(c_k-c_{-k})$. I get: $a_k=frac{-2}{pi(k^2-1)}, a_0=frac{2}{pi}$ and $b_k$ is $0$.



      So $f(x)=frac{a_0}{2}+sum_{k=1}^{infty}a_kcos(kx)$



      I then use Parseval's theorem to evaluate the sum we are looking for, remembering that k is even, i.e. $k=2n$ and that the function is $0$ between $pi$ and $2pi$:



      $$frac{1}{pi}int_{0}^{2pi}|f(x)|^2 dx=frac{a_0^2}{2}+sum_{k=1}^{infty}a_k^2$$ (1)



      $$frac{1}{pi}int_{0}^{pi}sin^2(x)dx=frac{frac{2^2}{pi^2}}{2}+sum_{n=1}^{infty}frac{4}{pi^2(4n^2-1)^2}$$ (2)
      $$frac{1}{2}-frac{2}{pi^2}=sum_{n=1}^{infty}frac{4}{pi^2(4n^2-1)^2}$$ (3)



      So finally I get$frac{pi^2}{8}-frac{1}{2}=sum_{n=1}^{infty}frac{1}{(4n^2-1)^2}$ (4)



      However, WolframAlpha gets $frac{pi^2}{16}-frac{1}{2}$ so I must somehow have forgotten a factor of $frac{1}{2}$ or put an extra factor of $2$ by $frac{pi^2}{8}$.



      Logically, this missing/extra factor must have happened while I was evaluating $frac{1}{pi}int_{0}^{pi}sin^2(x)dx$ because the $-frac{1}{2}$ at the end that came from the right side of the equality is correct according to WolframAlpha. But even when I evaluate $frac{1}{pi}int_{0}^{pi}sin^2(x)dx$ in WolframAlpha, I get the $frac{1}{2}$ from step (3) which finally becomes $frac{pi^2}{8}$ and again, an factor of $frac{1}{2}$ is missing, so I'm a bit perplex about what's wrong.



      Thanks for your help !



      Edit: the strange thing is that when I evaluate this sum using Parseval but with the fourier series of |sin(x)| between $0$ and $2pi$, I get the correct result.










      share|cite|improve this question











      $endgroup$




      I'm asked to find the fourier series of the $2 pi $ periodic function f(x) which is $sin(x)$ between $0$ and $pi$ and $0$ between $pi$ and $2pi$



      I use the complex form to proceed and get $$frac{1}{2pi}int_{0}^{pi}sin(x)e^{-ikx}dx$$. The complex coefficient $c_k$ I get as result is $frac{-1}{pi(k^2-1)}$ where $k=2n$ (k even) which is also correct according to WolframAlpha.



      But then, I'm asked to use this result to evaluate $sum_{n=1}^{infty}frac{1}{(4n^2-1)^2}$. For that, I switch to the real coefficients using $a_k=c_k+c_{-k}, b_k=i(c_k-c_{-k})$. I get: $a_k=frac{-2}{pi(k^2-1)}, a_0=frac{2}{pi}$ and $b_k$ is $0$.



      So $f(x)=frac{a_0}{2}+sum_{k=1}^{infty}a_kcos(kx)$



      I then use Parseval's theorem to evaluate the sum we are looking for, remembering that k is even, i.e. $k=2n$ and that the function is $0$ between $pi$ and $2pi$:



      $$frac{1}{pi}int_{0}^{2pi}|f(x)|^2 dx=frac{a_0^2}{2}+sum_{k=1}^{infty}a_k^2$$ (1)



      $$frac{1}{pi}int_{0}^{pi}sin^2(x)dx=frac{frac{2^2}{pi^2}}{2}+sum_{n=1}^{infty}frac{4}{pi^2(4n^2-1)^2}$$ (2)
      $$frac{1}{2}-frac{2}{pi^2}=sum_{n=1}^{infty}frac{4}{pi^2(4n^2-1)^2}$$ (3)



      So finally I get$frac{pi^2}{8}-frac{1}{2}=sum_{n=1}^{infty}frac{1}{(4n^2-1)^2}$ (4)



      However, WolframAlpha gets $frac{pi^2}{16}-frac{1}{2}$ so I must somehow have forgotten a factor of $frac{1}{2}$ or put an extra factor of $2$ by $frac{pi^2}{8}$.



      Logically, this missing/extra factor must have happened while I was evaluating $frac{1}{pi}int_{0}^{pi}sin^2(x)dx$ because the $-frac{1}{2}$ at the end that came from the right side of the equality is correct according to WolframAlpha. But even when I evaluate $frac{1}{pi}int_{0}^{pi}sin^2(x)dx$ in WolframAlpha, I get the $frac{1}{2}$ from step (3) which finally becomes $frac{pi^2}{8}$ and again, an factor of $frac{1}{2}$ is missing, so I'm a bit perplex about what's wrong.



      Thanks for your help !



      Edit: the strange thing is that when I evaluate this sum using Parseval but with the fourier series of |sin(x)| between $0$ and $2pi$, I get the correct result.







      integration complex-analysis fourier-analysis fourier-series parsevals-identity






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Dec 13 '18 at 20:28







      Poujh

















      asked Dec 13 '18 at 19:12









      PoujhPoujh

      616516




      616516






















          1 Answer
          1






          active

          oldest

          votes


















          2












          $begingroup$

          I can't check your calculations since you haven't included them, but it is clear that the Fourier series you found is not the Fourier series of $f$. Your function is not even, so it cannot have a Fourier cosine series. For example,



          $$ b_1 = frac{1}{pi} int_0^{2pi} f(x) sin(x) , dx = frac{1}{pi} int_0^{pi} sin^2(x) , dx = frac{1}{2}. $$



          My guess is that you haven't been careful in checking the special case when integrating the complex form (that is, $int e^{ikx} , dx = frac{e^{ikx}}{ik} + C$ only when $k neq 0$). In fact, the Fourier series of $f$ is given by



          $$ sum_{k = 1}^{infty} frac{2}{pi(1-4k^2)} cos(2kx) + frac{1}{pi} + frac{1}{2} sin(x) $$



          and you'll get your missing factor from the extra $sin$ term.





          The complex coefficient $c_1$ is given by



          $$ c_1 = frac{1}{2pi} int_0^{2pi} f(x) e^{-ix} , dx = frac{1}{2pi} int_0^{pi} frac{e^{ix} - e^{-ix}}{2i} e^{-ix} , dx = frac{1}{4pi i} int_0^{pi} (1 - e^{-2ix}) dx = frac{1}{4pi i} left[x - frac{e^{-2ix}}{-2i} right]_{x = 0}^{x = pi} = -frac{1}{4}i. $$
          Similarly,



          $$ c_{-1} = frac{1}{2pi} int_0^{2pi} f(x) e^{ix} , dx = frac{1}{2pi} int_0^{pi} frac{e^{ix} - e^{-ix}}{2i} e^{ix} , dx = frac{1}{4pi i} int_0^{pi} (e^{2ix} - 1) dx = frac{1}{4pi i} left[frac{e^{2ix}}{2i} - x right]_{x = 0}^{x = pi} = frac{1}{4}i. $$



          Hence,



          $$ b_1 = i(c_1 - c_{-1}) = i(-frac{1}{4}i - frac{1}{4}i) = frac{1}{2}. $$






          share|cite|improve this answer











          $endgroup$









          • 1




            $begingroup$
            @Poujh: This is actually a good example of how you want to be careful with Wolfram alpha... if you plug in $n = 1$ into the formula Wolfram gives you, you get $frac{0}{0}$. The case $n = 1$ is special and contributes the $sin$ term.
            $endgroup$
            – levap
            Dec 13 '18 at 21:27






          • 1




            $begingroup$
            @Poujh: No, the complex coefficients have all the information, you just didn't calculate $c_1,c_{-1}$ correctly. See my edit.
            $endgroup$
            – levap
            Dec 13 '18 at 21:40








          • 1




            $begingroup$
            @Poujh: When you calculate a real Fourier series, you have two options: Calculate the complex coefficients $c_n$ and then convert them into the real coefficients $a_n,b_n$ using the formulas you wrote. When calculating the integrals defining the coefficients, you have to be careful not to apply a formula if the assumptions don't hold. Beware of division by zero. In your case, the only problem with applying the formula is when $k = 1$ or $k = -1$ and this you can just do by hand. I wouldn't apply L'Hopital since it is not rigorous (especially if this is a math course) and won't always work.
            $endgroup$
            – levap
            Dec 13 '18 at 22:05








          • 1




            $begingroup$
            The other option is just to calculate $a_n,b_n$ directly. This might involve more work (you have to calculate two kinds of integrals instead of one, use trigonometric identities instead of exponentiation laws, etc) and also here, you have to be careful not to divide by zero. In your example, the reason that $b_1$ is non-zero is that $c_1$ has an imaginary part and the reason that all the other $b_i$'s are zero is that all the other $c_i$'s don't have any imaginary part (they are zero or real).
            $endgroup$
            – levap
            Dec 13 '18 at 22:11






          • 1




            $begingroup$
            Okay, makes a lot of sense. Our professor never said something like that to us. Thank you very much and have a good evening !
            $endgroup$
            – Poujh
            Dec 13 '18 at 22:16











          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "69"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3038460%2fextra-factor-of-2-when-evaluating-an-infinite-sum-using-fourier-series-and-parse%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2












          $begingroup$

          I can't check your calculations since you haven't included them, but it is clear that the Fourier series you found is not the Fourier series of $f$. Your function is not even, so it cannot have a Fourier cosine series. For example,



          $$ b_1 = frac{1}{pi} int_0^{2pi} f(x) sin(x) , dx = frac{1}{pi} int_0^{pi} sin^2(x) , dx = frac{1}{2}. $$



          My guess is that you haven't been careful in checking the special case when integrating the complex form (that is, $int e^{ikx} , dx = frac{e^{ikx}}{ik} + C$ only when $k neq 0$). In fact, the Fourier series of $f$ is given by



          $$ sum_{k = 1}^{infty} frac{2}{pi(1-4k^2)} cos(2kx) + frac{1}{pi} + frac{1}{2} sin(x) $$



          and you'll get your missing factor from the extra $sin$ term.





          The complex coefficient $c_1$ is given by



          $$ c_1 = frac{1}{2pi} int_0^{2pi} f(x) e^{-ix} , dx = frac{1}{2pi} int_0^{pi} frac{e^{ix} - e^{-ix}}{2i} e^{-ix} , dx = frac{1}{4pi i} int_0^{pi} (1 - e^{-2ix}) dx = frac{1}{4pi i} left[x - frac{e^{-2ix}}{-2i} right]_{x = 0}^{x = pi} = -frac{1}{4}i. $$
          Similarly,



          $$ c_{-1} = frac{1}{2pi} int_0^{2pi} f(x) e^{ix} , dx = frac{1}{2pi} int_0^{pi} frac{e^{ix} - e^{-ix}}{2i} e^{ix} , dx = frac{1}{4pi i} int_0^{pi} (e^{2ix} - 1) dx = frac{1}{4pi i} left[frac{e^{2ix}}{2i} - x right]_{x = 0}^{x = pi} = frac{1}{4}i. $$



          Hence,



          $$ b_1 = i(c_1 - c_{-1}) = i(-frac{1}{4}i - frac{1}{4}i) = frac{1}{2}. $$






          share|cite|improve this answer











          $endgroup$









          • 1




            $begingroup$
            @Poujh: This is actually a good example of how you want to be careful with Wolfram alpha... if you plug in $n = 1$ into the formula Wolfram gives you, you get $frac{0}{0}$. The case $n = 1$ is special and contributes the $sin$ term.
            $endgroup$
            – levap
            Dec 13 '18 at 21:27






          • 1




            $begingroup$
            @Poujh: No, the complex coefficients have all the information, you just didn't calculate $c_1,c_{-1}$ correctly. See my edit.
            $endgroup$
            – levap
            Dec 13 '18 at 21:40








          • 1




            $begingroup$
            @Poujh: When you calculate a real Fourier series, you have two options: Calculate the complex coefficients $c_n$ and then convert them into the real coefficients $a_n,b_n$ using the formulas you wrote. When calculating the integrals defining the coefficients, you have to be careful not to apply a formula if the assumptions don't hold. Beware of division by zero. In your case, the only problem with applying the formula is when $k = 1$ or $k = -1$ and this you can just do by hand. I wouldn't apply L'Hopital since it is not rigorous (especially if this is a math course) and won't always work.
            $endgroup$
            – levap
            Dec 13 '18 at 22:05








          • 1




            $begingroup$
            The other option is just to calculate $a_n,b_n$ directly. This might involve more work (you have to calculate two kinds of integrals instead of one, use trigonometric identities instead of exponentiation laws, etc) and also here, you have to be careful not to divide by zero. In your example, the reason that $b_1$ is non-zero is that $c_1$ has an imaginary part and the reason that all the other $b_i$'s are zero is that all the other $c_i$'s don't have any imaginary part (they are zero or real).
            $endgroup$
            – levap
            Dec 13 '18 at 22:11






          • 1




            $begingroup$
            Okay, makes a lot of sense. Our professor never said something like that to us. Thank you very much and have a good evening !
            $endgroup$
            – Poujh
            Dec 13 '18 at 22:16
















          2












          $begingroup$

          I can't check your calculations since you haven't included them, but it is clear that the Fourier series you found is not the Fourier series of $f$. Your function is not even, so it cannot have a Fourier cosine series. For example,



          $$ b_1 = frac{1}{pi} int_0^{2pi} f(x) sin(x) , dx = frac{1}{pi} int_0^{pi} sin^2(x) , dx = frac{1}{2}. $$



          My guess is that you haven't been careful in checking the special case when integrating the complex form (that is, $int e^{ikx} , dx = frac{e^{ikx}}{ik} + C$ only when $k neq 0$). In fact, the Fourier series of $f$ is given by



          $$ sum_{k = 1}^{infty} frac{2}{pi(1-4k^2)} cos(2kx) + frac{1}{pi} + frac{1}{2} sin(x) $$



          and you'll get your missing factor from the extra $sin$ term.





          The complex coefficient $c_1$ is given by



          $$ c_1 = frac{1}{2pi} int_0^{2pi} f(x) e^{-ix} , dx = frac{1}{2pi} int_0^{pi} frac{e^{ix} - e^{-ix}}{2i} e^{-ix} , dx = frac{1}{4pi i} int_0^{pi} (1 - e^{-2ix}) dx = frac{1}{4pi i} left[x - frac{e^{-2ix}}{-2i} right]_{x = 0}^{x = pi} = -frac{1}{4}i. $$
          Similarly,



          $$ c_{-1} = frac{1}{2pi} int_0^{2pi} f(x) e^{ix} , dx = frac{1}{2pi} int_0^{pi} frac{e^{ix} - e^{-ix}}{2i} e^{ix} , dx = frac{1}{4pi i} int_0^{pi} (e^{2ix} - 1) dx = frac{1}{4pi i} left[frac{e^{2ix}}{2i} - x right]_{x = 0}^{x = pi} = frac{1}{4}i. $$



          Hence,



          $$ b_1 = i(c_1 - c_{-1}) = i(-frac{1}{4}i - frac{1}{4}i) = frac{1}{2}. $$






          share|cite|improve this answer











          $endgroup$









          • 1




            $begingroup$
            @Poujh: This is actually a good example of how you want to be careful with Wolfram alpha... if you plug in $n = 1$ into the formula Wolfram gives you, you get $frac{0}{0}$. The case $n = 1$ is special and contributes the $sin$ term.
            $endgroup$
            – levap
            Dec 13 '18 at 21:27






          • 1




            $begingroup$
            @Poujh: No, the complex coefficients have all the information, you just didn't calculate $c_1,c_{-1}$ correctly. See my edit.
            $endgroup$
            – levap
            Dec 13 '18 at 21:40








          • 1




            $begingroup$
            @Poujh: When you calculate a real Fourier series, you have two options: Calculate the complex coefficients $c_n$ and then convert them into the real coefficients $a_n,b_n$ using the formulas you wrote. When calculating the integrals defining the coefficients, you have to be careful not to apply a formula if the assumptions don't hold. Beware of division by zero. In your case, the only problem with applying the formula is when $k = 1$ or $k = -1$ and this you can just do by hand. I wouldn't apply L'Hopital since it is not rigorous (especially if this is a math course) and won't always work.
            $endgroup$
            – levap
            Dec 13 '18 at 22:05








          • 1




            $begingroup$
            The other option is just to calculate $a_n,b_n$ directly. This might involve more work (you have to calculate two kinds of integrals instead of one, use trigonometric identities instead of exponentiation laws, etc) and also here, you have to be careful not to divide by zero. In your example, the reason that $b_1$ is non-zero is that $c_1$ has an imaginary part and the reason that all the other $b_i$'s are zero is that all the other $c_i$'s don't have any imaginary part (they are zero or real).
            $endgroup$
            – levap
            Dec 13 '18 at 22:11






          • 1




            $begingroup$
            Okay, makes a lot of sense. Our professor never said something like that to us. Thank you very much and have a good evening !
            $endgroup$
            – Poujh
            Dec 13 '18 at 22:16














          2












          2








          2





          $begingroup$

          I can't check your calculations since you haven't included them, but it is clear that the Fourier series you found is not the Fourier series of $f$. Your function is not even, so it cannot have a Fourier cosine series. For example,



          $$ b_1 = frac{1}{pi} int_0^{2pi} f(x) sin(x) , dx = frac{1}{pi} int_0^{pi} sin^2(x) , dx = frac{1}{2}. $$



          My guess is that you haven't been careful in checking the special case when integrating the complex form (that is, $int e^{ikx} , dx = frac{e^{ikx}}{ik} + C$ only when $k neq 0$). In fact, the Fourier series of $f$ is given by



          $$ sum_{k = 1}^{infty} frac{2}{pi(1-4k^2)} cos(2kx) + frac{1}{pi} + frac{1}{2} sin(x) $$



          and you'll get your missing factor from the extra $sin$ term.





          The complex coefficient $c_1$ is given by



          $$ c_1 = frac{1}{2pi} int_0^{2pi} f(x) e^{-ix} , dx = frac{1}{2pi} int_0^{pi} frac{e^{ix} - e^{-ix}}{2i} e^{-ix} , dx = frac{1}{4pi i} int_0^{pi} (1 - e^{-2ix}) dx = frac{1}{4pi i} left[x - frac{e^{-2ix}}{-2i} right]_{x = 0}^{x = pi} = -frac{1}{4}i. $$
          Similarly,



          $$ c_{-1} = frac{1}{2pi} int_0^{2pi} f(x) e^{ix} , dx = frac{1}{2pi} int_0^{pi} frac{e^{ix} - e^{-ix}}{2i} e^{ix} , dx = frac{1}{4pi i} int_0^{pi} (e^{2ix} - 1) dx = frac{1}{4pi i} left[frac{e^{2ix}}{2i} - x right]_{x = 0}^{x = pi} = frac{1}{4}i. $$



          Hence,



          $$ b_1 = i(c_1 - c_{-1}) = i(-frac{1}{4}i - frac{1}{4}i) = frac{1}{2}. $$






          share|cite|improve this answer











          $endgroup$



          I can't check your calculations since you haven't included them, but it is clear that the Fourier series you found is not the Fourier series of $f$. Your function is not even, so it cannot have a Fourier cosine series. For example,



          $$ b_1 = frac{1}{pi} int_0^{2pi} f(x) sin(x) , dx = frac{1}{pi} int_0^{pi} sin^2(x) , dx = frac{1}{2}. $$



          My guess is that you haven't been careful in checking the special case when integrating the complex form (that is, $int e^{ikx} , dx = frac{e^{ikx}}{ik} + C$ only when $k neq 0$). In fact, the Fourier series of $f$ is given by



          $$ sum_{k = 1}^{infty} frac{2}{pi(1-4k^2)} cos(2kx) + frac{1}{pi} + frac{1}{2} sin(x) $$



          and you'll get your missing factor from the extra $sin$ term.





          The complex coefficient $c_1$ is given by



          $$ c_1 = frac{1}{2pi} int_0^{2pi} f(x) e^{-ix} , dx = frac{1}{2pi} int_0^{pi} frac{e^{ix} - e^{-ix}}{2i} e^{-ix} , dx = frac{1}{4pi i} int_0^{pi} (1 - e^{-2ix}) dx = frac{1}{4pi i} left[x - frac{e^{-2ix}}{-2i} right]_{x = 0}^{x = pi} = -frac{1}{4}i. $$
          Similarly,



          $$ c_{-1} = frac{1}{2pi} int_0^{2pi} f(x) e^{ix} , dx = frac{1}{2pi} int_0^{pi} frac{e^{ix} - e^{-ix}}{2i} e^{ix} , dx = frac{1}{4pi i} int_0^{pi} (e^{2ix} - 1) dx = frac{1}{4pi i} left[frac{e^{2ix}}{2i} - x right]_{x = 0}^{x = pi} = frac{1}{4}i. $$



          Hence,



          $$ b_1 = i(c_1 - c_{-1}) = i(-frac{1}{4}i - frac{1}{4}i) = frac{1}{2}. $$







          share|cite|improve this answer














          share|cite|improve this answer



          share|cite|improve this answer








          edited Dec 13 '18 at 21:40

























          answered Dec 13 '18 at 21:15









          levaplevap

          47.5k33274




          47.5k33274








          • 1




            $begingroup$
            @Poujh: This is actually a good example of how you want to be careful with Wolfram alpha... if you plug in $n = 1$ into the formula Wolfram gives you, you get $frac{0}{0}$. The case $n = 1$ is special and contributes the $sin$ term.
            $endgroup$
            – levap
            Dec 13 '18 at 21:27






          • 1




            $begingroup$
            @Poujh: No, the complex coefficients have all the information, you just didn't calculate $c_1,c_{-1}$ correctly. See my edit.
            $endgroup$
            – levap
            Dec 13 '18 at 21:40








          • 1




            $begingroup$
            @Poujh: When you calculate a real Fourier series, you have two options: Calculate the complex coefficients $c_n$ and then convert them into the real coefficients $a_n,b_n$ using the formulas you wrote. When calculating the integrals defining the coefficients, you have to be careful not to apply a formula if the assumptions don't hold. Beware of division by zero. In your case, the only problem with applying the formula is when $k = 1$ or $k = -1$ and this you can just do by hand. I wouldn't apply L'Hopital since it is not rigorous (especially if this is a math course) and won't always work.
            $endgroup$
            – levap
            Dec 13 '18 at 22:05








          • 1




            $begingroup$
            The other option is just to calculate $a_n,b_n$ directly. This might involve more work (you have to calculate two kinds of integrals instead of one, use trigonometric identities instead of exponentiation laws, etc) and also here, you have to be careful not to divide by zero. In your example, the reason that $b_1$ is non-zero is that $c_1$ has an imaginary part and the reason that all the other $b_i$'s are zero is that all the other $c_i$'s don't have any imaginary part (they are zero or real).
            $endgroup$
            – levap
            Dec 13 '18 at 22:11






          • 1




            $begingroup$
            Okay, makes a lot of sense. Our professor never said something like that to us. Thank you very much and have a good evening !
            $endgroup$
            – Poujh
            Dec 13 '18 at 22:16














          • 1




            $begingroup$
            @Poujh: This is actually a good example of how you want to be careful with Wolfram alpha... if you plug in $n = 1$ into the formula Wolfram gives you, you get $frac{0}{0}$. The case $n = 1$ is special and contributes the $sin$ term.
            $endgroup$
            – levap
            Dec 13 '18 at 21:27






          • 1




            $begingroup$
            @Poujh: No, the complex coefficients have all the information, you just didn't calculate $c_1,c_{-1}$ correctly. See my edit.
            $endgroup$
            – levap
            Dec 13 '18 at 21:40








          • 1




            $begingroup$
            @Poujh: When you calculate a real Fourier series, you have two options: Calculate the complex coefficients $c_n$ and then convert them into the real coefficients $a_n,b_n$ using the formulas you wrote. When calculating the integrals defining the coefficients, you have to be careful not to apply a formula if the assumptions don't hold. Beware of division by zero. In your case, the only problem with applying the formula is when $k = 1$ or $k = -1$ and this you can just do by hand. I wouldn't apply L'Hopital since it is not rigorous (especially if this is a math course) and won't always work.
            $endgroup$
            – levap
            Dec 13 '18 at 22:05








          • 1




            $begingroup$
            The other option is just to calculate $a_n,b_n$ directly. This might involve more work (you have to calculate two kinds of integrals instead of one, use trigonometric identities instead of exponentiation laws, etc) and also here, you have to be careful not to divide by zero. In your example, the reason that $b_1$ is non-zero is that $c_1$ has an imaginary part and the reason that all the other $b_i$'s are zero is that all the other $c_i$'s don't have any imaginary part (they are zero or real).
            $endgroup$
            – levap
            Dec 13 '18 at 22:11






          • 1




            $begingroup$
            Okay, makes a lot of sense. Our professor never said something like that to us. Thank you very much and have a good evening !
            $endgroup$
            – Poujh
            Dec 13 '18 at 22:16








          1




          1




          $begingroup$
          @Poujh: This is actually a good example of how you want to be careful with Wolfram alpha... if you plug in $n = 1$ into the formula Wolfram gives you, you get $frac{0}{0}$. The case $n = 1$ is special and contributes the $sin$ term.
          $endgroup$
          – levap
          Dec 13 '18 at 21:27




          $begingroup$
          @Poujh: This is actually a good example of how you want to be careful with Wolfram alpha... if you plug in $n = 1$ into the formula Wolfram gives you, you get $frac{0}{0}$. The case $n = 1$ is special and contributes the $sin$ term.
          $endgroup$
          – levap
          Dec 13 '18 at 21:27




          1




          1




          $begingroup$
          @Poujh: No, the complex coefficients have all the information, you just didn't calculate $c_1,c_{-1}$ correctly. See my edit.
          $endgroup$
          – levap
          Dec 13 '18 at 21:40






          $begingroup$
          @Poujh: No, the complex coefficients have all the information, you just didn't calculate $c_1,c_{-1}$ correctly. See my edit.
          $endgroup$
          – levap
          Dec 13 '18 at 21:40






          1




          1




          $begingroup$
          @Poujh: When you calculate a real Fourier series, you have two options: Calculate the complex coefficients $c_n$ and then convert them into the real coefficients $a_n,b_n$ using the formulas you wrote. When calculating the integrals defining the coefficients, you have to be careful not to apply a formula if the assumptions don't hold. Beware of division by zero. In your case, the only problem with applying the formula is when $k = 1$ or $k = -1$ and this you can just do by hand. I wouldn't apply L'Hopital since it is not rigorous (especially if this is a math course) and won't always work.
          $endgroup$
          – levap
          Dec 13 '18 at 22:05






          $begingroup$
          @Poujh: When you calculate a real Fourier series, you have two options: Calculate the complex coefficients $c_n$ and then convert them into the real coefficients $a_n,b_n$ using the formulas you wrote. When calculating the integrals defining the coefficients, you have to be careful not to apply a formula if the assumptions don't hold. Beware of division by zero. In your case, the only problem with applying the formula is when $k = 1$ or $k = -1$ and this you can just do by hand. I wouldn't apply L'Hopital since it is not rigorous (especially if this is a math course) and won't always work.
          $endgroup$
          – levap
          Dec 13 '18 at 22:05






          1




          1




          $begingroup$
          The other option is just to calculate $a_n,b_n$ directly. This might involve more work (you have to calculate two kinds of integrals instead of one, use trigonometric identities instead of exponentiation laws, etc) and also here, you have to be careful not to divide by zero. In your example, the reason that $b_1$ is non-zero is that $c_1$ has an imaginary part and the reason that all the other $b_i$'s are zero is that all the other $c_i$'s don't have any imaginary part (they are zero or real).
          $endgroup$
          – levap
          Dec 13 '18 at 22:11




          $begingroup$
          The other option is just to calculate $a_n,b_n$ directly. This might involve more work (you have to calculate two kinds of integrals instead of one, use trigonometric identities instead of exponentiation laws, etc) and also here, you have to be careful not to divide by zero. In your example, the reason that $b_1$ is non-zero is that $c_1$ has an imaginary part and the reason that all the other $b_i$'s are zero is that all the other $c_i$'s don't have any imaginary part (they are zero or real).
          $endgroup$
          – levap
          Dec 13 '18 at 22:11




          1




          1




          $begingroup$
          Okay, makes a lot of sense. Our professor never said something like that to us. Thank you very much and have a good evening !
          $endgroup$
          – Poujh
          Dec 13 '18 at 22:16




          $begingroup$
          Okay, makes a lot of sense. Our professor never said something like that to us. Thank you very much and have a good evening !
          $endgroup$
          – Poujh
          Dec 13 '18 at 22:16


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Mathematics Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3038460%2fextra-factor-of-2-when-evaluating-an-infinite-sum-using-fourier-series-and-parse%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Bundesstraße 106

          Verónica Boquete

          Ida-Boy-Ed-Garten