I am solving an assignment in a programming course and am stuck on a mathematical problem that I am supposed to solve. In the assignment, a function

$f(x)=\sum_{k=0}^{n}a_k \cos(2k\pi x)+b_k\sin(2k\pi x)$

is defined, where $a_k,b_k$ are real coefficients, and I am asked to work out the Rayleigh quotient, given by


I am having trouble calculating this Rayleigh qoutient. I start by squaring the function and, methodically, trying to compute the terms separately, but this gets very messy very quickly and I am simply stuck on this. Is there a more elegant way to solve this? My guess is that there has to be, as I doubt that I am supposed to do "complicated" mathematical computations in this programming course.

By the way, I am unsure wether the function defined here can be properly called a fourier function, as I am not very familiar with such functions, so please correct me if my title is misleading.


Yes, this is a Fourier series, although it has only finitely terms so it's normally called a trigonometric polynomial. The most important feature of Fourier series (apart from periodicity) is that the various terms are orthogonal to one another: because $n,m$ are integers, we have $$ \int_0^1 \cos{2\pi n x} \sin{2\pi m x} \, dx = 0 \\ \int_0^1 \cos{2\pi n x} \cos{2\pi m x} \, dx = \begin{cases} 1 & n=m=0 \\ 1/2 & n=m \neq 0 \\ 0 & n \neq m \end{cases} \\ \int_0^1 \sin{2\pi n x} \sin{2\pi m x} \, dx = \begin{cases} 0 & n=m=0 \\ 1/2 & n=m \neq 0 \\ 0 & n \neq m \end{cases}; $$ these relationships are fundamental, and are proved using relationships, known as the prosthaphaeresis formulae (or more prosaically, the product-to-sum and sum-to-product formulae), derived from the angle-addition formulae you should know and love: for example, $$ 2\sin{A}\cos{B} = \sin{(A+B)}+\sin{(A-B)}, $$ by expanding the right-hand side. The right-hand side is then easy to integrate, and always gives zero. The other two formulae, $$ 2\cos{A}\cos{B} = \cos{(A+B)} + \cos{(A-B)} \\ 2\sin{A}\sin{B} = -\cos{(A+B)}+\cos{(A-B)} $$ (notice the funny sign in the latter!) are used for the others: since $\cos{(A-B)}=1$ if $A=B$, this is where the nonzero terms come from most of the time. If $A+B=0$ as well, the first term is also constant. But you will find that all the other terms integrate to zero due to periodicity; this is the key point.

Now, the relevance of this to your problem is that it may be used to prove Parseval's (or Plancherel's, depending who you ask) relation, which says that if $$ g(x) = \sum_{k=0}^{\infty} A_k \cos{2\pi k x} + B_k \sin{2\pi k x}, $$ then $$ \int_0^1 g(x)^2 \, dx = A_0^2 + \frac{1}{2} \sum_{k=1}^{\infty} (A_k^2+B_k^2), $$ by expanding the product and using the orthogonality relations, which cause all but the terms with equal $k$ to vanish. This applies to the numerator of your quotient equally well, since the derivative of $ a_k \cos{2\pi k x} + b_k \sin{2\pi k x} $ is $-2\pi k a_k \sin{2\pi k x}+2\pi k b_k \cos{2\pi k x}$, of the same form as $g$ with the coefficients changed around.

| cite | improve this answer | |
  • $\begingroup$ Thank you for your comprehensive answer! Just to be sure, is it true that $R$ evaluates to $\sqrt{\frac{2a_0+(a_1+b_1+\dots+a_n+b_n)}{2b_0+(a_1+b_1+\dots+a_n+b_n)}}$ (using the notation as in the question)? $\endgroup$ – Tyron Mar 30 '17 at 16:08
  • $\begingroup$ $\sin{0}=0$, so there is no $b_0$ term. All the $a_k$ and $b_k$ should be squared (think of units). The ones on the top should be multiplied by $k^2$. So no, I'm afraid you're not very close. I think it should be $$ \sqrt{ \frac{\sum_{k=1}^n k^2 (a_k^2+b_k^2) }{2a_0^2+\sum_{k=1}^n (a_k^2+b_k^2)} }. $$ $\endgroup$ – Chappers Mar 30 '17 at 16:26
  • $\begingroup$ Actually, I noticed a mistake in my calculation; $a_0$ and $b_0$ should switch places and every coefficient has to be squared, of course. In other words: $\sqrt{\frac{2b_0^2+(a_1^2+b_1^2+\dots+a_n^2+b_n^2)}{2a_0^2+(a_1^2+b_1^2+\dots+a_n^2+b_n^2)}}$ $\endgroup$ – Tyron Mar 30 '17 at 16:29
  • $\begingroup$ $b_0\sin{2\pi 0x} = 0$, so there can be no $b_0$ term. And you're still missing a $4\pi^2k^2$ on the top. (should be a factor of $4\pi^2$ in my comment above). $\endgroup$ – Chappers Mar 30 '17 at 16:33
  • $\begingroup$ Oh of course, I forgot about the extra terms arising from integration. Shouldn't the $(2\pi k)^2$ be $(2\pi k)^{-2}$, though, because we are integrating, not differentiating? And indeed, the terms should be squared. I had calculated that correctly, but hadn't written it down correctly in my first comment. Thanks for pointing out the $b_0^2$ term, I kind of missed that one, even though at some point I had thought about it. By the way, my previous comment might seem to ignore your comment before that; I hadn't noticed you had placed that comment when typing mine. $\endgroup$ – Tyron Mar 30 '17 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.