I have a question ask to find Fourier cosine series, so my approach as follow:

Given $\phi(x) = x^2$ and $x \in [0,1]$. For $n \neq 0$, directly applying the formulas, we have $$A_n = 2 \int_0^1 x^2 \cos(n \pi x)dx$$ Integrating by parts twice leads \begin{align*} A_n &= 2x^2 \frac{\sin(n \pi x)}{n \pi} \bigg|_0^1 - 4 \int_0^1 x \frac{\sin(n \pi x)}{n \pi}dx\\ &= 4x \frac{\cos(n \pi x)}{(n \pi)^2} \bigg|_0^1 -4 \int_0^1 \frac{\cos(n \pi x)}{(n \pi)^2}dx \\ &= 4 \cdot \frac{(-1)^n}{(n \pi)^2} \end{align*} and it's easy to see that when $n = 0$, $$A_0 = 2 \int_0^1 x^2 dx = \frac{2}{3}$$

Then I have a heat equation $$u_t = u_{xx}, 0< x < 1, t >0$$ $$u_x(0,t) = 0 = u(1,t)$$ with initial condition $$u(x,0) = x^2$$ We omit the detail here since it takes few pages, so I eventually came up a general solution $$u(x,t)= A_0+ \sum_{n = 0}^{\infty}A_n e^{-(n \pi)^2t} \cos(n \pi x)$$ by superposition principle. So now, I noticed the initial condition having the same function as we found above for Fourier cosine series, so it should turns out the exactly same solution. However, as I study from the book or online source, it states that $$A_0 = \int_0^l \phi(x)dx$$ Now something really confused me, because there's no 2 in front of the integral while $A_n = 2 \int_0^l \phi(x) \cos(n \pi x)dx$. So it leads a different $A_0$ as we obtained from above.

I might did something wrong here, or missed something obvious, but any suggestion would be appreciate.


1 Answer 1


The expression is of the form

$$ \phi(x) = \frac{A_0}{\color{red}{2}} + \sum_{n > 0} A_n \cos(\cdots $$

That makes the factor of two in your expression match with the other answers you have seen. Just to show you're on the right track, this is an example of your solution including up to $N$ terms in the sum and dividing by two $A_0$

enter image description here

  • $\begingroup$ Thanks for helping, that makes me clear now. However, I have one more question, is there any way to tell in what sense does the cosine series converges to the function $x^2$ on interval $[0,1]$? $\endgroup$
    – hh vh
    Apr 28, 2020 at 20:49
  • $\begingroup$ @hhvh this link may be of help $\endgroup$
    – caverac
    Apr 28, 2020 at 23:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .