This is the function I am having trouble with. This is for a wave function problem for a particle in a box. $$ \int_0^L \sin^2\left(\frac{n\pi x}{L}\right) dx$$
I know the end result has to be: $$\frac{L}{2}$$ I don't know what steps were done to get there and I need help. Must have well-defined steps that I can follow.
Edit: As a previous commenter pointed to as a starting point, I think I should try with trig identities.
Trying what @PrincessEev suggested to start, I get:
$$\int_0^L \sin^2 (u)du $$ where $$ u = \frac {n\pi x}{L} $$
Using the trig identity, I should get:
$$\int_0^L \frac {1-\cos(2u)}{2}du$$
A possible next step I could try is to pull the denominator out of the integral (if that's possible), like so:
$$\frac{1}{2} \int_0^L (1- \cos(2u))du$$
Following that, I could invoke the integral table:
$$\frac {1}{2} \int_0^L (1 - \cos(2u))du = \frac{1}{2} \left(\left.\frac{1}{2} \sin(2u)\right\rvert_0^L\right)$$
Adding onto that, replace u and simplify:
$$ \frac {1}{2} \left(\left.\frac{1}{2}\sin\left(\frac{2n\pi x}{L}\right)\right\rvert_0^L\right) $$
Edit 2- If that is right, then: $$\frac{1}{4}\left[\sin\left(\frac{2n\pi L}{L}\right)-\sin\left(\frac{2n\pi x0}{L}\right)\right]$$
If so, then: $$ \frac{1}{4} (\sin(2n\pi) - 0)$$ since $$\sin(0) = 0$$
I know something here is off. I am definitely missing the $L$ somewhere... I must have messed something up here. Despite that, I got up to here with what you guys suggested (and thank you for that). Need some help with where to go from here and some critique of my steps so far. Thank you @ D S for help on how to structure the response.
You're on the right track, but you've made a couple of mistakes.
You can't just replace $dx$ with $du$, or keep the endpoints of the integral the same, when you substitute in $u$. Since $u=\frac{n\pi x}{L}$, you differentiate the LHS and RHS with respect to $u$ and $x$, respectively, to get $du=\frac{n\pi}{L}dx$, or $dx=\frac{L}{n\pi} u$. Similarly, when $x=L$ you have $u=n\pi$ (and when $x=0$ you have $u=0$), so the integral should be from 0 to $n\pi$.
You've treated the $1-\cos(2u)$ like it was $\cos(2u)$ when you applied the integral table. You need to either integrate the $1$ and the $\cos(2u)$ as separate linear terms, or separate the integral into $\frac{L}{n\pi}\left(\int_0^{n\pi} 1 \,du-\int_0^{n\pi} \cos(2u)du \right)$. Then you can apply your table. (Also, you've forgotten a minus sign, but in the end that won't matter).
If you fix those, everything should work.