Finding the integral of $x\sec(2x)$ using integration by parts I need to find the integral of $\int x\sec(2x)dx $, but if I use integration by parts, I get an answer of  $\int x\sec(2x)dx =0 $, which I know isn't correct.
First I let $u=\sec(2x)$ and $v'=x$. This gave me $$\frac{2x\sec(2x)}{2}−\int x\sec(2x)\tan(2x)dx$$ Then I let $u=x^2$ and $v'=\sec(2x)\tan(2x)$ which gave $$\frac{2x\sec(2x)}{2}−\int x\sec(2x)dx$$
Putting both together yields $$\int x\sec(2x)=\frac{2x\sec(2x)}{2}−\frac{2x\sec(2x)}{2}−\int x\sec(2x)$$
 As you can see, everything cancels out, and I'm left with $0$.
 A: You're getting $0$ because you forgot to distribute a minus sign. To restate your work:
$$\begin{eqnarray*}\int x\sec(2x)&=&\frac{x2\sec(2x)}{2}−\int x2\sec(2x)\tan(2x)dx\\
&=&\frac{x2\sec(2x)}{2}−\left(\frac{x2\sec(2x)}{2}−\int x\sec(2x)\right)\\
&=&\int x\sec(2x)\end{eqnarray*}$$
So, that just leaves you back where you started.
I don't think you can do this with integration by parts. The solution needs polylogarithm functions to be expressed in a closed form.
A: whenever you do integration by parts twice...
$\int f(x)g(x)\ dx = F(x)G(x) - \int G(x)f'(x)\ dx$
If you need to do parts again, you need to be integrating factor $G(x)$ and differentiating the $f'(x)$ factor, or you will just be undoing the previous integration by parts taking back to where you began.
As for the function you have to integrate, it appears to either be a mess or impossible to integrate into elementary functions.
A: I have a deep feeling this is a typo from wherever you got this problem from. I am guessing what was meant was
$$
\int x \sec^2 x \;dx,
$$
which you should not have too much problem with given your work on the given problem. The given problem is a hot nightmare to integrate, as you can see at this link.
A: I agree that what you just presented must be a typo, and quite likely it is $\int x\sec^2x dx$ . This one can be integrated by parts as can be seen in this link (step-by-step calculation) https://www.integral-calculator.com/#expr=x%2Asec%28x%29%2Asec%28x%29 
whereas what you presented cannot just be integrated by parts. It is fairly complicated to be integrated, as can be seen in this link (full step-by-step description)
https://www.integral-calculator.com/#expr=x%2Asec%282x%29
