Evaluate $\int x \sec(x)\,dx$ So for one my exercise question is this: 
$$\int x \sec(x)\,dx$$
I tried every way that I can think of. I believe this could only be done in integration by parts. My class only learned three techniques which is PFD, $u$ -sub, and integration by parts. I tried $u = x$, $u = \sec(x)$ and then, $u = x\sec(x)$, which didn't help.
Any help would be great. 
 A: Well, use the identity:
$$\sec\left(x\right):=\frac{1}{\cos\left(x\right)}=\frac{2}{e^{xi}+e^{-xi}}\tag1$$
So, we get that:
$$\mathcal{I}\left(x\right):=\int x\sec\left(x\right)\space\text{d}x=2\int\frac{x}{e^{xi}+e^{-xi}}\space\text{d}x=2\int\frac{xe^{xi}}{1+e^{2xi}}\space\text{d}x\tag2$$
Now, substittue $\text{u}=xi$:
$$2\int\frac{xe^{xi}}{1+e^{2xi}}\space\text{d}x=-2\int\frac{\text{u}e^\text{u}}{1+e^{2\text{u}}}\space\text{d}\text{u}\tag3$$
Now, substitute $\text{v}=e^\text{u}$:
$$-2\int\frac{\text{u}e^\text{u}}{1+e^{2\text{u}}}\space\text{d}\text{u}=-2\int\frac{\ln\left(\text{v}\right)}{1+\text{v}^2}\space\text{d}\text{v}\tag4$$
Now, we know that:
$$1+\text{v}^2=\left(\text{v}-i\right)\left(\text{v}+i\right)\tag5$$
So, using partial fraction decomposition:
$$-2\int\frac{\ln\left(\text{v}\right)}{1+\text{v}^2}\space\text{d}\text{v}=-2\int\frac{\ln\left(\text{v}\right)}{\left(\text{v}-i\right)\left(\text{v}+i\right)}\space\text{d}\text{v}=i\left\{\int\frac{\ln\left(\text{v}\right)}{\text{v}-i}\space\text{d}\text{v}-\int\frac{\ln\left(\text{v}\right)}{\text{v}+i}\space\text{d}\text{v}\right\}\tag6$$
