# Integration problem?

## Homework Statement

$$\int_0^a x Sin^2\left(\frac{nx\pi}{a}\right) dx$$

## The Attempt at a Solution

$$\int_a^b f(x) g'(x)\, dx = \left[ f(x) g(x) \right]_{a}^{b} - \int_a^b f'(x) g(x)\, dx\$$

$$\left| x \left[ \frac{nx\pi}{2a}-\frac{Sin\left(2nx\pi\right)}{4a}\right] \right|^{a}_{0}- \int_0^a \frac{nx\pi}{2a}-\frac{Sin\left(2nx\pi\right)}{4a}$$

$$a \left[ \frac{n\pi}{2}-\frac{Sin\left(2n\pi\right)}{4}\right] - \int_0^a \frac{nx\pi}{2a}-\frac{Sin\left(2nx\pi\right)}{4a}$$

$$a \left[ \frac{n\pi}{2}-\frac{Sin\left(2n\pi\right)}{4}\right] - \frac{1}{2a} \int_0^a nx\pi-\frac{Sin\left(2nx\pi\right)}{2}$$

$$a \left[ \frac{n\pi}{2}-\frac{Sin\left(2n\pi\right)}{4}\right] - \frac{1}{2a}\left[ \int_0^a nx\pi-\int_0^a\frac{Sin\left(2nx\pi\right)}{2}\right]$$

$$a \left[ \frac{n\pi}{2}-\frac{Sin\left(2n\pi\right)}{4}\right] - \frac{1}{2a}\left[ n\pi\int_0^a x- \frac{1}{2}\int_0^a Sin\left(2nx\pi\right)\right]$$

$$a \left[ \frac{n\pi}{2}-\frac{Sin\left(2n\pi\right)}{4}\right] - \frac{1}{2a}\left[ n\pi \left | x\right |^{a}_{0} - \frac{1}{2} \left| Sin\left(2nx\pi\right)\right|^{a}_{0}\right]$$

$$a \left[ \frac{n\pi}{2}-\frac{Sin\left(2n\pi\right)}{4}\right] - \frac{1}{2a}\left[ n\pi a - \frac{1}{2} Sin\left(2na\pi\right)\right]$$

$$a \left[ \frac{n\pi}{2}-\frac{Sin\left(2n\pi\right)}{4}\right] - \left[ \frac{n\pi}{2} - \frac{1}{4a} Sin\left(2na\pi\right)\right]$$

$$Sin\left(2n\pi\right) = 0$$
$$Sin\left(2na\pi\right) = 0$$

$$a \left[ \frac{n\pi}{2}\right] - \left[ \frac{n\pi}{2} \right]$$

I'm kinda stuck here....

I know the answer is $$\frac{a}{2}$$

but I'm not sure how to get to it...maybe an integration mistake?

$$\frac{d}{dx}\left[ \frac{nx\pi}{2a}-\frac{Sin\left(2nx\pi\right)}{4a}\right]=Sin^2\left(\frac{nx\pi}{a}\right)$$ which is not true
You need to use the identity $$\cos(2x) = 1 - 2\sin^2(x)$$ to turn $$\sin^2(x)$$ into a sum of things you know how to integrate (either directly or using integration by parts).