Help with calculating the integral $\int_{-\pi}^\pi \cos\left(x/2\right) \cdot e^{ix} dx$ by using Eulers formula

70 Views Asked by At

I have to determine the following integral

$$ \int_{-\pi}^\pi \cos\left(x/2\right) \cdot e^{ix} dx $$ by using Eulers formula $$ \cos\left(x/2\right) = \frac{e^{ix/2}+e^{-ix/2}}{2} $$ we have that \begin{align*} \int_{-\pi}^\pi \cos\left(x/2\right) e^{ix} dx & = \frac{1}{2} \int_{-\pi}^\pi \left(e^{ix/2}+e^{-ix/2}\right) e^{ix} dx \\ & = \frac{1}{2} \int_{-\pi}^\pi e^{\frac{i3x}{2}}+e^{-\frac{i3x}{2}} dx \\ & = \frac{1}{2} \left[ \frac{2}{3i} e^{\frac{i3x}{2}} - \frac{2}{3i} e^{\frac{-i3x}{2}}\right]_{-\pi}^\pi \\ & = \frac{1}{2}\left(\frac{2}{3i}\cdot \left(-i\right)-\frac{2}{3i}\cdot \left(\frac{1}{-i}\right)-\left(\frac{2}{3i}\cdot \left(\frac{1}{-i}\right)-\frac{2}{3i}\cdot \left(-i\right)\right)\right) \\ & = -4/3 \end{align*} but the answer should be $4/3$. Why do I get a minus instead? Do you mind helping me? Thanks in advance.

2

There are 2 best solutions below

1
On BEST ANSWER

You have a small error going from the first to the second line in your last formula... $e^{-ix/2} e^{ix} = e^{ix/2}$.

2
On

Well, as you wrote we know that (and it is really easy to prove):

$$\cos(x)=\frac{\exp\left(xi\right)+\exp\left(-xi\right)}{2}\tag1$$

Where $\exp(\cdot)$ is the Exponential function.

So, we also know that:

$$\cos\left(\text{n}x\right)=\frac{\exp\left(\text{n}xi\right)+\exp\left(-\text{n}xi\right)}{2}\tag2$$

So, for your integral we have:

$$\mathcal{I}_\text{n}\left(\beta,\text{k}\right):=\int_{-\beta}^\beta\cos\left(\text{n}x\right)\exp\left(\text{k}xi\right)\space\text{d}x\tag3$$

Using $(2)$ we can rewrite $(3)$:

$$\mathcal{I}_\text{n}\left(\beta,\text{k}\right)=\int_{-\beta}^\beta\frac{\exp\left(\text{n}xi\right)+\exp\left(-\text{n}xi\right)}{2}\cdot\exp\left(\text{k}xi\right)\space\text{d}x=$$ $$\frac{1}{2}\cdot\left\{\int_{-\beta}^\beta\exp\left(\text{n}xi\right)\exp\left(\text{k}xi\right)\space\text{d}x+\int_{-\beta}^\beta\exp\left(-\text{n}xi\right)\exp\left(\text{k}xi\right)\space\text{d}x\right\}=$$ $$\frac{1}{2}\cdot\left\{\int_{-\beta}^\beta\exp\left(\text{n}xi+\text{k}xi\right)\space\text{d}x+\int_{-\beta}^\beta\exp\left(\text{k}xi-\text{n}xi\right)\space\text{d}x\right\}=$$ $$\frac{1}{2}\cdot\left\{\int_{-\beta}^\beta\exp\left(x\left(\text{n}+\text{k}\right)i\right)\space\text{d}x+\int_{-\beta}^\beta\exp\left(x\left(\text{k}-\text{n}\right)i\right)\space\text{d}x\right\}\tag4$$

Now, we can solve another integral:

$$\int_{-\alpha}^\alpha\exp\left(\text{p}x\right)\space\text{d}x\tag5$$

Substitute $\text{u}=\text{p}x$, so we get:

$$\int_{-\alpha}^\alpha\exp\left(\text{p}x\right)\space\text{d}x=\frac{1}{\text{p}}\int_{-\alpha\text{p}}^{\alpha\text{p}}\exp\left(\text{u}\right)\space\text{du}=\frac{1}{\text{p}}\cdot\left[\exp\left(\text{u}\right)\right]_{-\alpha\text{p}}^{\alpha\text{p}}=$$ $$\frac{\exp\left(\alpha\text{p}\right)-\exp\left(-\alpha\text{p}\right)}{\text{p}}\tag6$$

So:

  • $$\int_{-\beta}^\beta\exp\left(x\left(\text{n}+\text{k}\right)i\right)\space\text{d}x=\frac{\exp\left(\beta\left(\text{n}+\text{k}\right)i\right)-\exp\left(-\beta\left(\text{n}+\text{k}\right)i\right)}{\left(\text{n}+\text{k}\right)i}\tag7$$
  • $$\int_{-\beta}^\beta\exp\left(x\left(\text{k}-\text{n}\right)i\right)\space\text{d}x=\frac{\exp\left(\beta\left(\text{k}-\text{n}\right)i\right)-\exp\left(-\beta\left(\text{k}-\text{n}\right)i\right)}{\left(\text{k}-\text{n}\right)i}\tag8$$

So, in your case we have $\beta=\pi$, $\text{n}=\frac{1}{2}$, and $\text{k}=1$, so:

$$\mathcal{I}_\frac{1}{2}\left(\pi,1\right)=\frac{4}{3}\tag9$$