Integration by parts twice yields $0=0$?

I had this question: $$\int 3x\sec^2(4x) dx$$

After doing integration by parts for the first time, setting $u=3x$ and $dv=\sec^2(4x)dx$ and doing derivative and integral, I got $$\int 3x\sec^2(4x) dx = \frac{3}{4}x\tan(4x)-\frac{3}{4}\int \tan(4x) dx$$

At this point, I realize I can solve for the $\tan(4x)$ using $u$-substitution, but I continue doing integration by parts.

For $$\int \tan(4x) dx$$ I substitute $u=\tan(4x)$ and $dv=1dx$ getting $$\int \tan(4x) dx = \tan(4x)\cdot x - \int x\cdot 4\sec^2(4x)dx$$

Substituting everything back in, I get $$\int 3x\sec^2(4x) dx = \frac{3}{4}x\tan(4x) - \frac{3}{4}\left(\tan(4x)\cdot x -\int x\cdot 4\sec^2(4x)dx\right)$$

Distributing the $3/4$ and simplifying, I get $0=0$ — that's not the answer. I don't believe I broke any rules using integration by parts, yet the answer is invalid. Why doesn't this work?

Thanks.

• I'd just like to point out that, in fact, zero does equal zero. – law-of-fives Feb 6 '18 at 4:39
• :/............... – Art Feb 6 '18 at 4:40
• I didn't read your post in detail, but I would bet on a sign error – qbert Feb 6 '18 at 4:43
• But Art, I hope you realise that law-of-fives was making a serious point. You have not got an invalid answer. You have not made any algebraic mistakes (I assume - didn't actually check), and the answer you have got is a correct equation. It happens to be useless because it doesn't tell you the value of the integral you want, but that's a different thing... – David Feb 6 '18 at 4:45
• Your second integration by parts is not wrong, but it's taking you backwards: first you had $dv = \sec^24x dx$ to get $v = \frac14 \tan 4x$, and then you set $u = \tan 4x$ to get $du = 4 \sec^24x dx$. This is like multiplying by 2 then dividing by 2. – Théophile Feb 6 '18 at 4:47

$$\int u \, dv = uv - \int v \, du = uv - \left(uv - \int u \,dv\right)=\int u \, dv$$
This is essentially what you just did. The $u$ in your second integration by parts is equal to the $v$ in your first one, and vice versa.