# Thread: Trig integral with x^2

1. ## Trig integral with x^2

I want to evaluate the following 2 integrals: $\frac{2}{a} \int_{\frac{-a}{4}}^{\frac{3a}{4}} x \sin^2 \left[\frac{n\pi}{a} \left(x + \frac{a}{4}\right) \right] \, dx = \frac{a}{4}$

I think this is correct.

But $x^2$ is more difficult: $\frac{2}{a} \int_{\frac{-a}{4}}^{\frac{3a}{4}} x^2 \sin^2 \left[ \frac{n\pi}{a} \left(x + \frac{a}{4}\right) \right] \, dx$

Using integration by parts I let:

$u=x^2 \Rightarrow du = 2x dx$

$dv = sin^2 \left[ \frac{n\pi}{a} \left(x + \frac{a}{4} \right) \right] \, dx$

$\Rightarrow v = \frac{x}{2} - \frac{a}{2n\pi} \sin \left[\frac{n\pi}{a} \left(x + \frac{a}{4} \right) \right] \cos \left[ \frac{n\pi}{a} \left(x + \frac{a}{4} \right) \right] = \frac{x}{2} - \frac{a}{4n\pi} \sin \left[ \frac{2n\pi}{a} \left(x + \frac{a}{4}\right) \right]$

(double angle formula used)

$< x^2 > = uv - \int v du = \frac{2}{a} \left[x^2 \, \frac{x}{2} - \frac{a}{4n\pi} \sin \left[ \frac{2n\pi}{a} \left( x + \frac{a}{4} \right) \right] \right]_{\frac{-a}{4}}^{\frac{3a}{4}}$ $\left. - \int_{\frac{-a}{4}}^{\frac{3a}{4}} 2x \left( \frac{x}{2}-\frac{a}{4n\pi} \sin \left[ \frac{2n\pi}{a} \left(x+\frac{a}{4} \right) \right] \right)dx\right ]$

$=\frac{2}{a}\left [ \frac{27a^3}{128}-\frac{-a^3}{128}-\int_{\frac{-a}{4}}^{\frac{3a}{4}}x^3dx+\frac{a}{4n\pi}\int_{\f rac{-a}{4}}^{\frac{3a}{4}}2xsin[\frac{2n\pi}{a}(x+\frac{a}{4})])dx\right ]$

$=\frac{2}{a}\left [ \frac{7a^3}{32}-\frac{5a^4}{64}+\frac{a}{2n\pi}\left ( \frac{a^2}{4n^2\pi^2}sin[\frac{2n\pi}{a}(x+\frac{a}{4})])-\frac{a}{2n\pi}xcos[\frac{2n\pi}{a}(x+\frac{a}{4})])\right )_{\frac{-a}{4}}^{\frac{3a}{4}}\right ]$

Sine term vanishes at both limits while cosine term as 1 at both limits:

$=\frac{2}{a}\left [ \frac{7a^3}{32}-\frac{5a^4}{64}+\frac{a}{2n\pi}\left ( \frac{-3a^2}{8n\pi}+\frac{a^2}{8n\pi} \right )\right ]=\frac{7a^2}{16}-\frac{a^2}{4n^2\pi^2}-\frac{5a^3}{32}=\frac{a^2(7n^2\pi^2-4)}{16n^2\pi^2}-\frac{5a^3}{32}$

This is obviously wrong since the units don't add up. How can there be $a^2$ and $a^3$ at the same time? They both have the dimension of meters. My answer should be in meters squared. I spend hours checking and still can't find my mistake.

I plug the equation into a graphic calculator, I think the answer should be: $\frac{a^2(7n^2\pi^2-24)}{64n^2\pi^2}$