# How to write $\cos^3\left(\frac{\pi x}{2a}\right)$ in the form $\sum\limits_{j=1}^n k_j\cos\left(\frac{j\pi x}{2a}\right)$?

For context; this is from a quantum mechanics problem where I need to write the wavefunction $$\psi(x)=\cos^3\left(\frac{\pi x}{2a}\right)$$ as a sum of single powered cosine terms with only the arguments and the constants $k_j$ for each term varying:

$$\sum\limits_{j=1}^n k_j\cos\left(\frac{j\pi x}{2a}\right)\tag{1}$$ where $a$ is a constant (half the width of the infinite square well)

This is my attempt so far:

Since

$$\cos^3\left(\frac{\pi x}{2a}\right)$$ is an even function $$\sum\limits_{j=1}^n k_j\cos\left(\frac{j\pi x}{2a}\right)$$ will only consist of terms with odd $j$ since I am solving a infinite square well problem for $$u_n(x)=\begin{cases} \cos\left(\frac{j\pi x}{2a}\right), & \text{if j is odd} \\ \sin\left(\frac{j\pi x}{2a}\right), & \text{if j is even} \end{cases}$$ where each $u_n(x)$ is an eigenfunction or a term in the summation $(1)$

So if I make an ansantz that I can write $(1)$ in the form $$k_1\cos\left(\frac{\pi x}{2a}\right)+k_2\cos\left(\frac{3\pi x}{2a}\right)$$ with $j=1$ and $3$ only.

But truthfully this is just a guess, and I still have no idea if it could be written for $j=5,7,9$ etc.

Anyhow, proceeding with the assumption has me stuck as I don't understand how to find the values of $k_1$ and $k_2$.

The correct answer is $$\fbox{\cos^3\left(\frac{\pi x}{2a}\right)=\frac34\cos\left(\frac{\pi x}{2a}\right)+\frac14\cos\left(\frac{3\pi x}{2a}\right)}$$

But how does one go about determining that $k_1=\frac34$ and $k_2=\frac14$?

But most importantly; How do you know how many terms ($j=1,3$ in this case) are required? Is it really just a guess or is there some method to it?

Best Regards.

## Edit:

This question has had no response thus far. Perhaps I was asking too many questions before, so for now I will simply ask if anyone is able to give me some hints or tips on how to show that $k_1=\frac34$ and $k_2=\frac14$?

## Edit #2:

In the comment below one user has given an incredibly useful link that explains the origin of that formula. But my question is; Unless you knew this from memory how would you find that formula? There must be some method that exists for finding the coefficients $k_1$ and $k_2$.

If it is believed to be absolutely impossible to find these coefficients and no such method exists, then please state this. It is a completely valid answer.

Many thanks.

• – MathGod Dec 3 '16 at 14:51

There are some general formulae that let you write powers of cosines as a sum of cosines. Specifically, the equation $$\cos^3(x) = \frac{3}{4} \cos(x) + \frac{1}{4} \cos(3x)$$ holds.
Such equations can be deduced by using complex numbers. For example, $$\cos(x) = \frac{e^{ix} + e^{-ix}}{2}$$ holds. Using the binomial theorem we get $$\cos^3(x) = \frac{1}{8} \left(e^{3ix} + 3e^{ix} + 3e^{-ix} + e^{-3ix}\right) = \frac{1}{4} \left(\frac{e^{i3x} + e^{-i3x}}{2} + 3\left(\frac{e^{ix} + e^{-ix}}{2}\right)\right) = \frac{1}{4} (\cos(3x) + 3\cos(x))$$